AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Player Class Reference

#include "Player.h"

Inheritance diagram for Player:
Unit GridObject< Player > WorldObject Object WorldLocation Position

Classes

struct  BgBattlegroundQueueID_Rec
 
struct  ChatFloodThrottle
 

Public Types

typedef std::unordered_map< ObjectGuid::LowType, Item * > ItemMap
 
typedef std::set< uint32DFQuestsDoneList
 
- Public Types inherited from Unit
typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::vector< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 Player (WorldSession *session)
 
 ~Player () override
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void SetObjectScale (float scale) override
 
bool hasSpanishClient ()
 
bool TeleportTo (uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
 
bool TeleportTo (WorldLocation const &loc, uint32 options=0, Unit *target=nullptr)
 
bool TeleportToEntryPoint ()
 
void SetSummonPoint (uint32 mapid, float x, float y, float z, uint32 delay=0, bool asSpectator=false)
 
bool IsSummonAsSpectator () const
 
void SetSummonAsSpectator (bool on)
 
void SummonIfPossible (bool agree, ObjectGuid summoner_guid)
 
time_t GetSummonExpireTimer () const
 
bool Create (ObjectGuid::LowType guidlow, CharacterCreateInfo *createInfo)
 
void Update (uint32 time) override
 
PlayerFlags GetPlayerFlags () const
 
bool HasPlayerFlag (PlayerFlags flags) const
 
void SetPlayerFlag (PlayerFlags flags)
 
void RemovePlayerFlag (PlayerFlags flags)
 
void ReplaceAllPlayerFlags (PlayerFlags flags)
 
bool IsClass (Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
 
void SetInWater (bool apply)
 
bool IsInWater () const override
 
bool IsFalling () const
 
bool IsInAreaTriggerRadius (AreaTrigger const *trigger, float delta=0.f) const
 
void SendInitialPacketsBeforeAddToMap ()
 
void SendInitialPacketsAfterAddToMap ()
 
void SendTransferAborted (uint32 mapid, TransferAbortReason reason, uint8 arg=0)
 
void SendInstanceResetWarning (uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap)
 
bool CanInteractWithQuestGiver (Object *questGiver)
 
CreatureGetNPCIfCanInteractWith (ObjectGuid guid, uint32 npcflagmask)
 
GameObjectGetGameObjectIfCanInteractWith (ObjectGuid guid, GameobjectTypes type) const
 
void ToggleAFK ()
 
void ToggleDND ()
 
bool isAFK () const
 
bool isDND () const
 
uint8 GetChatTag () const
 
uint32 GetBarberShopCost (uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const *newSkin=nullptr)
 
PlayerSocialGetSocial ()
 
void InitTaxiNodesForLevel ()
 
bool ActivateTaxiPathTo (std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
 
bool ActivateTaxiPathTo (uint32 taxi_path_id, uint32 spellid=1)
 
void CleanupAfterTaxiFlight ()
 
void ContinueTaxiFlight ()
 
void SendTaxiNodeStatusMultiple ()
 
bool IsCommentator () const
 
void SetCommentator (bool on)
 
bool IsDeveloper () const
 
void SetDeveloper (bool on)
 
bool isAcceptWhispers () const
 
void SetAcceptWhispers (bool on)
 
bool IsGameMaster () const
 
void SetGameMaster (bool on)
 
bool isGMChat () const
 
void SetGMChat (bool on)
 
bool IsGMSpectator () const
 
void SetGMSpectator (bool on)
 
bool isTaxiCheater () const
 
void SetTaxiCheater (bool on)
 
bool isGMVisible () const
 
void SetGMVisible (bool on)
 
bool Has310Flyer (bool checkAllSpells, uint32 excludeSpellId=0)
 
void SetHas310Flyer (bool on)
 
void SetPvPDeath (bool on)
 
void GiveXP (uint32 xp, Unit *victim, float group_rate=1.0f, bool isLFGReward=false)
 
void GiveLevel (uint8 level)
 
void InitStatsForLevel (bool reapplyMods=false)
 
bool HasActivePowerType (Powers power) override
 
bool GetCommandStatus (uint32 command) const
 
void SetCommandStatusOn (uint32 command)
 
void SetCommandStatusOff (uint32 command)
 
uint32 GetTotalPlayedTime ()
 
uint32 GetLevelPlayedTime ()
 
void setDeathState (DeathState s, bool despawn=false) override
 
void SetRestState (uint32 triggerId)
 
void RemoveRestState ()
 
uint32 GetXPRestBonus (uint32 xp)
 
float GetRestBonus () const
 
void SetRestBonus (float restBonusNew)
 
bool HasRestFlag (RestFlag restFlag) const
 
void SetRestFlag (RestFlag restFlag, uint32 triggerId=0)
 
void RemoveRestFlag (RestFlag restFlag)
 
uint32 GetInnTriggerId () const
 
PetStableGetPetStable ()
 
PetStableGetOrInitPetStable ()
 
PetStable const * GetPetStable () const
 
PetGetPet () const
 
PetSummonPet (uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration=0s, uint32 healthPct=0)
 
void RemovePet (Pet *pet, PetSaveMode mode, bool returnreagent=false)
 
bool CanPetResurrect ()
 
bool IsExistPet ()
 
PetCreatePet (Creature *creatureTarget, uint32 spellID=0)
 
PetCreatePet (uint32 creatureEntry, uint32 spellID=0)
 
uint32 GetPhaseMaskForSpawn () const
 
void Say (std::string_view text, Language language, WorldObject const *=nullptr) override
 Handles said message in regular chat based on declared language and in config pre-defined Range.
 
void Say (uint32 textId, WorldObject const *target=nullptr) override
 
void Yell (std::string_view text, Language language, WorldObject const *=nullptr) override
 Handles yelled message in regular chat based on declared language and in config pre-defined Range.
 
void Yell (uint32 textId, WorldObject const *target=nullptr) override
 
void TextEmote (std::string_view text, WorldObject const *=nullptr, bool=false) override
 Outputs an universal text which is supposed to be an action.
 
void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false) override
 
void Whisper (std::string_view text, Language language, Player *receiver, bool=false) override
 Handles whispers from Addons and players based on sender, receiver's guid and language.
 
void Whisper (uint32 textId, Player *target, bool isBossWhisper=false) override
 
void SetVirtualItemSlot (uint8 i, Item *item)
 
void SetSheath (SheathState sheathed) override
 
uint8 FindEquipSlot (ItemTemplate const *proto, uint32 slot, bool swap) const
 
uint32 GetItemCount (uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
 
uint32 GetItemCountWithLimitCategory (uint32 limitCategory, Item *skipItem=nullptr) const
 
ItemGetItemByGuid (ObjectGuid guid) const
 
ItemGetItemByEntry (uint32 entry) const
 
ItemGetItemByPos (uint16 pos) const
 
ItemGetItemByPos (uint8 bag, uint8 slot) const
 
BagGetBagByPos (uint8 slot) const
 
uint32 GetFreeInventorySpace () const
 
ItemGetUseableItemByPos (uint8 bag, uint8 slot) const
 
ItemGetWeaponForAttack (WeaponAttackType attackType, bool useable=false) const
 
bool HasWeapon (WeaponAttackType type) const override
 
bool HasWeaponForAttack (WeaponAttackType type) const override
 
ItemGetShield (bool useable=false) const
 
std::vector< Item * > & GetItemUpdateQueue ()
 
bool IsValidPos (uint16 pos, bool explicit_pos)
 
bool IsValidPos (uint8 bag, uint8 slot, bool explicit_pos)
 
uint8 GetBankBagSlotCount () const
 
void SetBankBagSlotCount (uint8 count)
 
bool HasItemCount (uint32 item, uint32 count=1, bool inBankAlso=false) const
 
bool HasItemFitToSpellRequirements (SpellInfo const *spellInfo, Item const *ignoreItem=nullptr) const
 
bool CanNoReagentCast (SpellInfo const *spellInfo) const
 
bool HasItemOrGemWithIdEquipped (uint32 item, uint32 count, uint8 except_slot=NULL_SLOT) const
 
bool HasItemOrGemWithLimitCategoryEquipped (uint32 limitCategory, uint32 count, uint8 except_slot=NULL_SLOT) const
 
InventoryResult CanTakeMoreSimilarItems (Item *pItem) const
 
InventoryResult CanTakeMoreSimilarItems (uint32 entry, uint32 count) const
 
InventoryResult CanStoreNewItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
 
InventoryResult CanStoreItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
 
InventoryResult CanStoreItems (Item **pItem, int32 count) const
 
InventoryResult CanEquipNewItem (uint8 slot, uint16 &dest, uint32 item, bool swap) const
 
InventoryResult CanEquipItem (uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
 
InventoryResult CanEquipUniqueItem (Item *pItem, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
 
InventoryResult CanEquipUniqueItem (ItemTemplate const *itemProto, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
 
InventoryResult CanUnequipItems (uint32 item, uint32 count) const
 
InventoryResult CanUnequipItem (uint16 src, bool swap) const
 
InventoryResult CanBankItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true) const
 
InventoryResult CanUseItem (Item *pItem, bool not_loading=true) const
 
bool HasItemTotemCategory (uint32 TotemCategory) const
 
bool IsTotemCategoryCompatiableWith (ItemTemplate const *pProto, uint32 requiredTotemCategoryId) const
 
InventoryResult CanUseItem (ItemTemplate const *pItem) const
 
InventoryResult CanUseAmmo (uint32 item) const
 
InventoryResult CanRollForItemInLFG (ItemTemplate const *item, WorldObject const *lootedObject) const
 
ItemStoreNewItem (ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
 
ItemStoreNewItem (ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters)
 
ItemStoreItem (ItemPosCountVec const &pos, Item *pItem, bool update)
 
ItemEquipNewItem (uint16 pos, uint32 item, bool update)
 
ItemEquipItem (uint16 pos, Item *pItem, bool update)
 
void AutoUnequipOffhandIfNeed (bool force=false)
 
bool StoreNewItemInBestSlots (uint32 item_id, uint32 item_count)
 
void AutoStoreLoot (uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
 
void AutoStoreLoot (uint32 loot_id, LootStore const &store, bool broadcast=false)
 
LootItemStoreLootItem (uint8 lootSlot, Loot *loot, InventoryResult &msg)
 
void UpdateLootAchievements (LootItem *item, Loot *loot)
 
void UpdateTitansGrip ()
 
InventoryResult CanTakeMoreSimilarItems (uint32 entry, uint32 count, Item *pItem, uint32 *no_space_count=nullptr) const
 
InventoryResult CanStoreItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem=nullptr, bool swap=false, uint32 *no_space_count=nullptr) const
 
void AddRefundReference (ObjectGuid itemGUID)
 
void DeleteRefundReference (ObjectGuid itemGUID)
 
void ApplyEquipCooldown (Item *pItem)
 
void SetAmmo (uint32 item)
 
void RemoveAmmo ()
 
float GetAmmoDPS () const
 
bool CheckAmmoCompatibility (ItemTemplate const *ammo_proto) const
 
void QuickEquipItem (uint16 pos, Item *pItem)
 
void VisualizeItem (uint8 slot, Item *pItem)
 
void SetVisibleItemSlot (uint8 slot, Item *pItem)
 
ItemBankItem (ItemPosCountVec const &dest, Item *pItem, bool update)
 
ItemBankItem (uint16 pos, Item *pItem, bool update)
 
void RemoveItem (uint8 bag, uint8 slot, bool update, bool swap=false)
 
void MoveItemFromInventory (uint8 bag, uint8 slot, bool update)
 
void MoveItemToInventory (ItemPosCountVec const &dest, Item *pItem, bool update, bool in_characterInventoryDB=false)
 
void RemoveItemDependentAurasAndCasts (Item *pItem)
 
void DestroyItem (uint8 bag, uint8 slot, bool update)
 
void DestroyItemCount (uint32 item, uint32 count, bool update, bool unequip_check=false)
 
void DestroyItemCount (Item *item, uint32 &count, bool update)
 
void DestroyConjuredItems (bool update)
 
void DestroyZoneLimitedItem (bool update, uint32 new_zone)
 
void SplitItem (uint16 src, uint16 dst, uint32 count)
 
void SwapItem (uint16 src, uint16 dst)
 
void AddItemToBuyBackSlot (Item *pItem, uint32 money)
 
ItemGetItemFromBuyBackSlot (uint32 slot)
 
void RemoveItemFromBuyBackSlot (uint32 slot, bool del)
 
uint32 GetMaxKeyringSize () const
 
void SendEquipError (InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
 
void SendBuyError (BuyResult msg, Creature *creature, uint32 item, uint32 param)
 
void SendSellError (SellResult msg, Creature *creature, ObjectGuid guid, uint32 param)
 
void AddWeaponProficiency (uint32 newflag)
 
void AddArmorProficiency (uint32 newflag)
 
uint32 GetWeaponProficiency () const
 
uint32 GetArmorProficiency () const
 
bool IsTwoHandUsed () const
 
void SendNewItem (Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
 
bool BuyItemFromVendorSlot (ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
 
bool _StoreOrEquipNewItem (uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const *crItem, bool bStore)
 
float GetReputationPriceDiscount (Creature const *creature) const
 
float GetReputationPriceDiscount (FactionTemplateEntry const *factionTemplate) const
 
PlayerGetTrader () const
 
TradeDataGetTradeData () const
 
void TradeCancel (bool sendback, TradeStatus status=TRADE_STATUS_TRADE_CANCELED)
 
CinematicMgrGetCinematicMgr () const
 
void UpdateEnchantTime (uint32 time)
 
void UpdateSoulboundTradeItems ()
 
void AddTradeableItem (Item *item)
 
void RemoveTradeableItem (Item *item)
 
void UpdateItemDuration (uint32 time, bool realtimeonly=false)
 
void AddEnchantmentDurations (Item *item)
 
void RemoveEnchantmentDurations (Item *item)
 
void RemoveEnchantmentDurationsReferences (Item *item)
 
void RemoveArenaEnchantments (EnchantmentSlot slot)
 
void AddEnchantmentDuration (Item *item, EnchantmentSlot slot, uint32 duration)
 
void ApplyEnchantment (Item *item, EnchantmentSlot slot, bool apply, bool apply_dur=true, bool ignore_condition=false)
 
void ApplyEnchantment (Item *item, bool apply)
 
void UpdateSkillEnchantments (uint16 skill_id, uint16 curr_value, uint16 new_value)
 
void SendEnchantmentDurations ()
 
void UpdateEnchantmentDurations ()
 
void BuildEnchantmentsInfoData (WorldPacket *data)
 
void AddItemDurations (Item *item)
 
void RemoveItemDurations (Item *item)
 
void SendItemDurations ()
 
void LoadCorpse (PreparedQueryResult result)
 
void LoadPet ()
 
bool AddItem (uint32 itemId, uint32 count)
 
void PrepareGossipMenu (WorldObject *source, uint32 menuId=0, bool showQuests=false)
 
void SendPreparedGossip (WorldObject *source)
 
void OnGossipSelect (WorldObject *source, uint32 gossipListId, uint32 menuId)
 
uint32 GetGossipTextId (uint32 menuId, WorldObject *source)
 
uint32 GetGossipTextId (WorldObject *source)
 
void ToggleInstantFlight ()
 
int32 GetQuestLevel (Quest const *quest) const
 
void PrepareQuestMenu (ObjectGuid guid)
 
void SendPreparedQuest (ObjectGuid guid)
 
bool IsActiveQuest (uint32 quest_id) const
 
Quest const * GetNextQuest (ObjectGuid guid, Quest const *quest)
 
bool CanSeeStartQuest (Quest const *quest)
 
bool CanTakeQuest (Quest const *quest, bool msg)
 
bool CanAddQuest (Quest const *quest, bool msg)
 
bool CanCompleteQuest (uint32 quest_id, const QuestStatusData *q_savedStatus=nullptr)
 
bool CanCompleteRepeatableQuest (Quest const *quest)
 
bool CanRewardQuest (Quest const *quest, bool msg)
 
bool CanRewardQuest (Quest const *quest, uint32 reward, bool msg)
 
void AddQuestAndCheckCompletion (Quest const *quest, Object *questGiver)
 
void AddQuest (Quest const *quest, Object *questGiver)
 
void AbandonQuest (uint32 quest_id)
 
void CompleteQuest (uint32 quest_id)
 
void IncompleteQuest (uint32 quest_id)
 
void RewardQuest (Quest const *quest, uint32 reward, Object *questGiver, bool announce=true, bool isLFGReward=false)
 
void SetRewardedQuest (uint32 quest_id)
 
void FailQuest (uint32 quest_id)
 
bool SatisfyQuestSkill (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestLevel (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestLog (bool msg)
 
bool SatisfyQuestPreviousQuest (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestClass (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestRace (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestReputation (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestStatus (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestConditions (Quest const *qInfo, bool msg)
 
bool SatisfyQuestTimed (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestExclusiveGroup (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestNextChain (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestPrevChain (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestDay (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestWeek (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestMonth (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestSeasonal (Quest const *qInfo, bool msg) const
 
bool GiveQuestSourceItem (Quest const *quest)
 
bool TakeQuestSourceItem (uint32 questId, bool msg)
 
uint32 CalculateQuestRewardXP (Quest const *quest)
 
bool GetQuestRewardStatus (uint32 quest_id) const
 
QuestStatus GetQuestStatus (uint32 quest_id) const
 
void SetQuestStatus (uint32 questId, QuestStatus status, bool update=true)
 
void RemoveActiveQuest (uint32 questId, bool update=true)
 
void RemoveRewardedQuest (uint32 questId, bool update=true)
 
void SendQuestUpdate (uint32 questId)
 
QuestGiverStatus GetQuestDialogStatus (Object *questGiver)
 
float GetQuestRate (bool isDFQuest=false)
 
void SetDailyQuestStatus (uint32 quest_id)
 
bool IsDailyQuestDone (uint32 quest_id)
 
void SetWeeklyQuestStatus (uint32 quest_id)
 
void SetMonthlyQuestStatus (uint32 quest_id)
 
void SetSeasonalQuestStatus (uint32 quest_id)
 
void ResetDailyQuestStatus ()
 
void ResetWeeklyQuestStatus ()
 
void ResetMonthlyQuestStatus ()
 
void ResetSeasonalQuestStatus (uint16 event_id)
 
uint16 FindQuestSlot (uint32 quest_id) const
 
uint32 GetQuestSlotQuestId (uint16 slot) const
 
uint32 GetQuestSlotState (uint16 slot) const
 
uint16 GetQuestSlotCounter (uint16 slot, uint8 counter) const
 
uint32 GetQuestSlotTime (uint16 slot) const
 
void SetQuestSlot (uint16 slot, uint32 quest_id, uint32 timer=0)
 
void SetQuestSlotCounter (uint16 slot, uint8 counter, uint16 count)
 
void SetQuestSlotState (uint16 slot, uint32 state)
 
void RemoveQuestSlotState (uint16 slot, uint32 state)
 
void SetQuestSlotTimer (uint16 slot, uint32 timer)
 
void SwapQuestSlot (uint16 slot1, uint16 slot2)
 
uint16 GetReqKillOrCastCurrentCount (uint32 quest_id, int32 entry)
 
void AreaExploredOrEventHappens (uint32 questId)
 
void GroupEventHappens (uint32 questId, WorldObject const *pEventObject)
 
void ItemAddedQuestCheck (uint32 entry, uint32 count)
 
void ItemRemovedQuestCheck (uint32 entry, uint32 count)
 
void KilledMonster (CreatureTemplate const *cInfo, ObjectGuid guid)
 
void KilledMonsterCredit (uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
 
void KilledPlayerCredit (uint16 count=1)
 
void KilledPlayerCreditForQuest (uint16 count, Quest const *quest)
 
void KillCreditGO (uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
 
void TalkedToCreature (uint32 entry, ObjectGuid guid)
 
void MoneyChanged (uint32 value)
 
void ReputationChanged (FactionEntry const *factionEntry)
 
void ReputationChanged2 (FactionEntry const *factionEntry)
 
bool HasQuestForItem (uint32 itemId, uint32 excludeQuestId=0, bool turnIn=false, bool *showInLoot=nullptr) const
 
bool HasQuestForGO (int32 GOId) const
 
bool HasQuest (uint32 questId) const
 
void UpdateForQuestWorldObjects ()
 
bool CanShareQuest (uint32 quest_id) const
 
void SendQuestComplete (uint32 quest_id)
 
void SendQuestReward (Quest const *quest, uint32 XP)
 
void SendQuestFailed (uint32 questId, InventoryResult reason=EQUIP_ERR_OK)
 
void SendQuestTimerFailed (uint32 quest_id)
 
void SendCanTakeQuestResponse (uint32 msg) const
 
void SendQuestConfirmAccept (Quest const *quest, Player *pReceiver)
 
void SendPushToPartyResponse (Player const *player, uint8 msg) const
 
void SendQuestUpdateAddItem (Quest const *quest, uint32 item_idx, uint16 count)
 
void SendQuestUpdateAddCreatureOrGo (Quest const *quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
 
void SendQuestUpdateAddPlayer (Quest const *quest, uint16 old_count, uint16 add_count)
 
ObjectGuid GetDivider ()
 
void SetDivider (ObjectGuid guid=ObjectGuid::Empty)
 
uint32 GetInGameTime ()
 
void SetInGameTime (uint32 time)
 
void AddTimedQuest (uint32 quest_id)
 
void RemoveTimedQuest (uint32 quest_id)
 
bool HasPvPForcingQuest () const
 
bool LoadFromDB (ObjectGuid guid, CharacterDatabaseQueryHolder const &holder)
 
bool isBeingLoaded () const override
 
void Initialize (ObjectGuid::LowType guid)
 
void SaveToDB (bool create, bool logout)
 
void SaveToDB (CharacterDatabaseTransaction trans, bool create, bool logout)
 
void SaveInventoryAndGoldToDB (CharacterDatabaseTransaction trans)
 
void SaveGoldToDB (CharacterDatabaseTransaction trans)
 
void _SaveSkills (CharacterDatabaseTransaction trans)
 
void SetBindPoint (ObjectGuid guid)
 
void SendTalentWipeConfirm (ObjectGuid guid)
 
void ResetPetTalents ()
 
void CalcRage (uint32 damage, bool attacker)
 
void RegenerateAll ()
 
void Regenerate (Powers power)
 
void RegenerateHealth ()
 
void setRegenTimerCount (uint32 time)
 
void setWeaponChangeTimer (uint32 time)
 
uint32 GetMoney () const
 
bool ModifyMoney (int32 amount, bool sendError=true)
 
bool HasEnoughMoney (uint32 amount) const
 
bool HasEnoughMoney (int32 amount) const
 
void SetMoney (uint32 value)
 
RewardedQuestSet const & getRewardedQuests () const
 
QuestStatusMapgetQuestStatusMap ()
 
QuestStatusSaveMapGetQuestStatusSaveMap ()
 
std::size_t GetRewardedQuestCount () const
 
bool IsQuestRewarded (uint32 quest_id) const
 
UnitGetSelectedUnit () const
 
PlayerGetSelectedPlayer () const
 
void SetTarget (ObjectGuid=ObjectGuid::Empty) override
 
void SetSelection (ObjectGuid guid)
 Used for serverside target changes, does not apply to players.
 
void SendMailResult (uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError=0, ObjectGuid::LowType item_guid=0, uint32 item_count=0)
 
void SendNewMail ()
 
void UpdateNextMailTimeAndUnreads ()
 
void AddNewMailDeliverTime (time_t deliver_time)
 
void RemoveMail (uint32 id)
 
void AddMail (Mail *mail)
 
uint32 GetMailSize ()
 
MailGetMail (uint32 id)
 
PlayerMails const & GetMails () const
 
void SendItemRetrievalMail (uint32 itemEntry, uint32 count)
 
void SendItemRetrievalMail (std::vector< std::pair< uint32, uint32 > > mailItems)
 
ItemGetMItem (ObjectGuid::LowType itemLowGuid)
 
void AddMItem (Item *it)
 
bool RemoveMItem (ObjectGuid::LowType itemLowGuid)
 
void PetSpellInitialize ()
 
void CharmSpellInitialize ()
 
void PossessSpellInitialize ()
 
void VehicleSpellInitialize ()
 
void SendRemoveControlBar ()
 
bool HasSpell (uint32 spell) const override
 
bool HasActiveSpell (uint32 spell) const
 
TrainerSpellState GetTrainerSpellState (TrainerSpell const *trainer_spell) const
 
bool IsSpellFitByClassAndRace (uint32 spell_id) const
 
bool IsNeedCastPassiveSpellAtLearn (SpellInfo const *spellInfo) const
 
void SendProficiency (ItemClass itemClass, uint32 itemSubclassMask)
 
void SendInitialSpells ()
 
void SendLearnPacket (uint32 spellId, bool learn)
 
bool addSpell (uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary=false, bool learnFromSkill=false)
 
bool _addSpell (uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
 
void learnSpell (uint32 spellId, bool temporary=false, bool learnFromSkill=false)
 
void removeSpell (uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
 
void resetSpells ()
 
void LearnCustomSpells ()
 
void LearnDefaultSkills ()
 
void LearnDefaultSkill (uint32 skillId, uint16 rank)
 
void learnQuestRewardedSpells ()
 
void learnQuestRewardedSpells (Quest const *quest)
 
void learnSpellHighRank (uint32 spellid)
 
bool CheckSkillLearnedBySpell (uint32 spellId)
 
void SetReputation (uint32 factionentry, float value)
 
uint32 GetReputation (uint32 factionentry) const
 
std::string const & GetGuildName ()
 
uint32 GetFreeTalentPoints () const
 
void SetFreeTalentPoints (uint32 points)
 
bool resetTalents (bool noResetCost=false)
 
uint32 resetTalentsCost () const
 
bool IsMaxLevel () const
 
void InitTalentForLevel ()
 
void BuildPlayerTalentsInfoData (WorldPacket *data)
 
void BuildPetTalentsInfoData (WorldPacket *data)
 
void SendTalentsInfoData (bool pet)
 
void LearnTalent (uint32 talentId, uint32 talentRank, bool command=false)
 
void LearnPetTalent (ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
 
bool addTalent (uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank)
 
void _removeTalent (PlayerTalentMap::iterator &itr, uint8 specMask)
 
void _removeTalent (uint32 spellId, uint8 specMask)
 
void _removeTalentAurasAndSpells (uint32 spellId)
 
void _addTalentAurasAndSpells (uint32 spellId)
 
bool HasTalent (uint32 spell_id, uint8 spec) const
 
uint32 CalculateTalentsPoints () const
 
void SetBonusTalentCount (uint32 count)
 
uint32 GetBonusTalentCount ()
 
void AddBonusTalent (uint32 count)
 
void RemoveBonusTalent (uint32 count)
 
void UpdateSpecCount (uint8 count)
 
uint8 GetActiveSpec () const
 
uint8 GetActiveSpecMask () const
 
void SetActiveSpec (uint8 spec)
 
uint8 GetSpecsCount () const
 
void SetSpecsCount (uint8 count)
 
void ActivateSpec (uint8 spec)
 
void LoadActions (PreparedQueryResult result)
 
void GetTalentTreePoints (uint8(&specPoints)[3]) const
 
uint8 GetMostPointsTalentTree () const
 
bool HasTankSpec ()
 
bool HasMeleeSpec ()
 
bool HasCasterSpec ()
 
bool HasHealSpec ()
 
uint32 GetSpec (int8 spec=-1)
 
void InitGlyphsForLevel ()
 
void SetGlyphSlot (uint8 slot, uint32 slottype)
 
uint32 GetGlyphSlot (uint8 slot) const
 
void SetGlyph (uint8 slot, uint32 glyph, bool save)
 
uint32 GetGlyph (uint8 slot) const
 
uint32 GetFreePrimaryProfessionPoints () const
 
void SetFreePrimaryProfessions (uint16 profs)
 
void InitPrimaryProfessions ()
 
PlayerSpellMap const & GetSpellMap () const
 
PlayerSpellMapGetSpellMap ()
 
SpellCooldowns const & GetSpellCooldownMap () const
 
SpellCooldownsGetSpellCooldownMap ()
 
SkillStatusMap const & GetSkillStatusMap () const
 
SkillStatusMapGetSkillStatusMap ()
 
void AddSpellMod (SpellModifier *mod, bool apply)
 
bool IsAffectedBySpellmod (SpellInfo const *spellInfo, SpellModifier *mod, Spell *spell=nullptr)
 
bool HasSpellMod (SpellModifier *mod, Spell *spell)
 
template<class T >
void ApplySpellMod (uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
 
void RemoveSpellMods (Spell *spell)
 
void RestoreSpellMods (Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
 
void RestoreAllSpellMods (uint32 ownerAuraId=0, Aura *aura=nullptr)
 
void DropModCharge (SpellModifier *mod, Spell *spell)
 
void SetSpellModTakingSpell (Spell *spell, bool apply)
 
bool HasSpellCooldown (uint32 spell_id) const override
 
bool HasSpellItemCooldown (uint32 spell_id, uint32 itemid) const override
 
uint32 GetSpellCooldownDelay (uint32 spell_id) const
 
void AddSpellAndCategoryCooldowns (SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
 
void AddSpellCooldown (uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
 
void _AddSpellCooldown (uint32 spell_id, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false)
 
void ModifySpellCooldown (uint32 spellId, int32 cooldown)
 
void SendCooldownEvent (SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
 
void ProhibitSpellSchool (SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
 
void RemoveSpellCooldown (uint32 spell_id, bool update=false)
 
void SendClearCooldown (uint32 spell_id, Unit *target)
 
GlobalCooldownMgrGetGlobalCooldownMgr ()
 
void RemoveCategoryCooldown (uint32 cat)
 
void RemoveArenaSpellCooldowns (bool removeActivePetCooldowns=false)
 
void RemoveAllSpellCooldown ()
 
void _LoadSpellCooldowns (PreparedQueryResult result)
 
void _SaveSpellCooldowns (CharacterDatabaseTransaction trans, bool logout)
 
uint32 GetLastPotionId ()
 
void SetLastPotionId (uint32 item_id)
 
void UpdatePotionCooldown (Spell *spell=nullptr)
 
void setResurrectRequestData (ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
 
void clearResurrectRequestData ()
 
bool isResurrectRequestedBy (ObjectGuid guid) const
 
bool isResurrectRequested () const
 
void ResurectUsingRequestData ()
 
uint8 getCinematic () const
 
void setCinematic (uint8 cine)
 
ActionButtonaddActionButton (uint8 button, uint32 action, uint8 type)
 
void removeActionButton (uint8 button)
 
ActionButton const * GetActionButton (uint8 button)
 
void SendInitialActionButtons () const
 
void SendActionButtons (uint32 state) const
 
bool IsActionButtonDataValid (uint8 button, uint32 action, uint8 type)
 
void UpdatePvPState ()
 
void UpdateFFAPvPState (bool reset=true)
 
void SetPvP (bool state)
 
void UpdatePvP (bool state, bool _override=false)
 
void UpdateZone (uint32 newZone, uint32 newArea, bool force=false)
 
void UpdateArea (uint32 newArea)
 
void SetNeedZoneUpdate (bool needUpdate)
 
void UpdateZoneDependentAuras (uint32 zone_id)
 
void UpdateAreaDependentAuras (uint32 area_id)
 
void UpdateAfkReport (time_t currTime)
 checks the 15 afk reports per 5 minutes limit
 
void UpdatePvPFlag (time_t currTime)
 
void UpdateFFAPvPFlag (time_t currTime)
 
void UpdateContestedPvP (uint32 currTime)
 
void SetContestedPvPTimer (uint32 newTime)
 
void ResetContestedPvP ()
 
void UpdateDuelFlag (time_t currTime)
 
void CheckDuelDistance (time_t currTime)
 
void DuelComplete (DuelCompleteType type)
 
void SendDuelCountdown (uint32 counter)
 
bool IsGroupVisibleFor (Player const *p) const
 
bool IsInSameGroupWith (Player const *p) const
 
bool IsInSameRaidWith (Player const *p) const
 
void UninviteFromGroup ()
 
void RemoveFromGroup (RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT)
 
void SendUpdateToOutOfRangeGroupMembers ()
 
void SetInGuild (uint32 GuildId)
 
void SetRank (uint8 rankId)
 
uint8 GetRank () const
 
void SetGuildIdInvited (uint32 GuildId)
 
uint32 GetGuildId () const
 
GuildGetGuild () const
 
uint32 GetGuildIdInvited ()
 
void SetInArenaTeam (uint32 ArenaTeamId, uint8 slot, uint8 type)
 
void SetArenaTeamInfoField (uint8 slot, ArenaTeamInfoType type, uint32 value)
 
uint32 GetArenaPersonalRating (uint8 slot) const
 
uint32 GetArenaTeamId (uint8 slot) const
 
void SetArenaTeamIdInvited (uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdInvited ()
 
Difficulty GetDifficulty (bool isRaid) const
 
Difficulty GetDungeonDifficulty () const
 
Difficulty GetRaidDifficulty () const
 
Difficulty GetStoredRaidDifficulty () const
 
void SetDungeonDifficulty (Difficulty dungeon_difficulty)
 
void SetRaidDifficulty (Difficulty raid_difficulty)
 
void StoreRaidMapDifficulty ()
 
bool UpdateSkill (uint32 skill_id, uint32 step)
 
bool UpdateSkillPro (uint16 SkillId, int32 Chance, uint32 step)
 
bool UpdateCraftSkill (uint32 spellid)
 
bool UpdateGatherSkill (uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator=1)
 
bool UpdateFishingSkill ()
 
uint32 GetBaseDefenseSkillValue () const
 
uint32 GetBaseWeaponSkillValue (WeaponAttackType attType) const
 
uint32 GetSpellByProto (ItemTemplate *proto)
 
float GetHealthBonusFromStamina ()
 
float GetManaBonusFromIntellect ()
 
bool UpdateStats (Stats stat) override
 
bool UpdateAllStats () override
 
void ApplySpellPenetrationBonus (int32 amount, bool apply)
 
void UpdateResistances (uint32 school) override
 
void UpdateArmor () override
 
void UpdateMaxHealth () override
 
void UpdateMaxPower (Powers power) override
 
void ApplyFeralAPBonus (int32 amount, bool apply)
 
void UpdateAttackPowerAndDamage (bool ranged=false) override
 
void UpdateShieldBlockValue ()
 
void ApplySpellPowerBonus (int32 amount, bool apply)
 
void ApplySpellDamageBonus (int32 amount, bool apply)
 
void ApplySpellHealingBonus (int32 amount, bool apply)
 
void UpdateSpellDamageAndHealingBonus ()
 
void ApplyRatingMod (CombatRating cr, int32 value, bool apply)
 
void UpdateRating (CombatRating cr)
 
void UpdateAllRatings ()
 
void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex) override
 
void UpdateDefenseBonusesMod ()
 
void RecalculateRating (CombatRating cr)
 
float GetMeleeCritFromAgility ()
 
void GetDodgeFromAgility (float &diminishing, float &nondiminishing)
 
float GetMissPercentageFromDefence () const
 
float GetSpellCritFromIntellect ()
 
float OCTRegenHPPerSpirit ()
 
float OCTRegenMPPerSpirit ()
 
float GetRatingMultiplier (CombatRating cr) const
 
float GetRatingBonusValue (CombatRating cr) const
 
uint32 GetBaseSpellPowerBonus ()
 
uint32 GetBaseSpellDamageBonus ()
 
uint32 GetBaseSpellHealingBonus ()
 
int32 GetSpellPenetrationItemMod () const
 
float GetExpertiseDodgeOrParryReduction (WeaponAttackType attType) const
 
void UpdateBlockPercentage ()
 
void UpdateCritPercentage (WeaponAttackType attType)
 
void UpdateAllCritPercentages ()
 
void UpdateParryPercentage ()
 
void UpdateDodgePercentage ()
 
void UpdateMeleeHitChances ()
 
void UpdateRangedHitChances ()
 
void UpdateSpellHitChances ()
 
void UpdateAllSpellCritChances ()
 
void UpdateSpellCritChance (uint32 school)
 
void UpdateArmorPenetration (int32 amount)
 
void UpdateExpertise (WeaponAttackType attType)
 
void ApplyManaRegenBonus (int32 amount, bool apply)
 
void ApplyHealthRegenBonus (int32 amount, bool apply)
 
void UpdateManaRegen ()
 
void UpdateEnergyRegen ()
 
void UpdateRuneRegen (RuneType rune)
 
ObjectGuid GetLootGUID () const
 
void SetLootGUID (ObjectGuid guid)
 
void RemovedInsignia (Player *looterPlr)
 
WorldSessionGetSession () const
 
void SetSession (WorldSession *sess)
 
void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) override
 
void DestroyForPlayer (Player *target, bool onDeath=false) const override
 
void SendLogXPGain (uint32 GivenXP, Unit *victim, uint32 BonusXP, bool recruitAFriend=false, float group_rate=1.0f)
 
void SendAttackSwingCantAttack ()
 
void SendAttackSwingCancelAttack ()
 
void SendAttackSwingDeadTarget ()
 
void SendAttackSwingNotInRange ()
 
void SendAttackSwingBadFacingAttack ()
 
void SendAutoRepeatCancel (Unit *target)
 
void SendExplorationExperience (uint32 Area, uint32 Experience)
 
void SendDungeonDifficulty (bool IsInGroup)
 
void SendRaidDifficulty (bool IsInGroup, int32 forcedDifficulty=-1)
 
void SendResetInstanceSuccess (uint32 MapId)
 
void SendResetInstanceFailed (uint32 reason, uint32 MapId)
 
void SendResetFailedNotify (uint32 mapid)
 
bool UpdatePosition (float x, float y, float z, float orientation, bool teleport=false) override
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void ProcessTerrainStatusUpdate () override
 
void SendMessageToSet (WorldPacket const *data, bool self) const override
 
void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const override
 
void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const override
 
void SendTeleportAckPacket ()
 
CorpseGetCorpse () const
 
void SpawnCorpseBones (bool triggerSave=true)
 
CorpseCreateCorpse ()
 
void RemoveCorpse ()
 
void KillPlayer ()
 
bool HasCorpse () const
 
WorldLocation GetCorpseLocation () const
 
uint32 GetResurrectionSpellId ()
 
void ResurrectPlayer (float restore_percent, bool applySickness=false)
 
void BuildPlayerRepop ()
 
void RepopAtGraveyard ()
 
void SendDurabilityLoss ()
 
void DurabilityLossAll (double percent, bool inventory)
 
void DurabilityLoss (Item *item, double percent)
 
void DurabilityPointsLossAll (int32 points, bool inventory)
 
void DurabilityPointsLoss (Item *item, int32 points)
 
void DurabilityPointLossForEquipSlot (EquipmentSlots slot)
 
uint32 DurabilityRepairAll (bool cost, float discountMod, bool guildBank)
 
uint32 DurabilityRepair (uint16 pos, bool cost, float discountMod, bool guildBank)
 
void UpdateMirrorTimers ()
 
void StopMirrorTimers ()
 
bool IsMirrorTimerActive (MirrorTimerType type)
 
void SetMovement (PlayerMovementType pType)
 
bool CanJoinConstantChannelInZone (ChatChannelsEntry const *channel, AreaTableEntry const *zone)
 
void JoinedChannel (Channel *c)
 
void LeftChannel (Channel *c)
 
void CleanupChannels ()
 
void ClearChannelWatch ()
 
void UpdateLFGChannel ()
 
void UpdateLocalChannels (uint32 newZone)
 
void UpdateDefense ()
 
void UpdateWeaponSkill (Unit *victim, WeaponAttackType attType, Item *item=nullptr)
 
void UpdateCombatSkills (Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
 
void SetSkill (uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
 
uint16 GetMaxSkillValue (uint32 skill) const
 
uint16 GetPureMaxSkillValue (uint32 skill) const
 
uint16 GetSkillValue (uint32 skill) const
 
uint16 GetBaseSkillValue (uint32 skill) const
 
uint16 GetPureSkillValue (uint32 skill) const
 
int16 GetSkillPermBonusValue (uint32 skill) const
 
int16 GetSkillTempBonusValue (uint32 skill) const
 
uint16 GetSkillStep (uint16 skill) const
 
bool HasSkill (uint32 skill) const
 
void learnSkillRewardedSpells (uint32 id, uint32 value)
 
WorldLocationGetTeleportDest ()
 
bool IsBeingTeleported () const
 
bool IsBeingTeleportedNear () const
 
bool IsBeingTeleportedFar () const
 
void SetSemaphoreTeleportNear (time_t tm)
 
void SetSemaphoreTeleportFar (time_t tm)
 
time_t GetSemaphoreTeleportNear () const
 
time_t GetSemaphoreTeleportFar () const
 
void ProcessDelayedOperations ()
 
uint32 GetDelayedOperations () const
 
void ScheduleDelayedOperation (uint32 operation)
 
void CheckAreaExploreAndOutdoor ()
 
TeamId GetTeamId (bool original=false) const
 
void SetFactionForRace (uint8 race)
 
void setTeamId (TeamId teamid)
 
void InitDisplayIds ()
 
bool IsAtGroupRewardDistance (WorldObject const *pRewardSource) const
 
bool IsAtLootRewardDistance (WorldObject const *pRewardSource) const
 
bool IsAtRecruitAFriendDistance (WorldObject const *pOther) const
 
void RewardPlayerAndGroupAtKill (Unit *victim, bool isBattleGround)
 
void RewardPlayerAndGroupAtEvent (uint32 creature_id, WorldObject *pRewardSource)
 
bool isHonorOrXPTarget (Unit *victim) const
 
bool GetsRecruitAFriendBonus (bool forXP)
 
uint8 GetGrantableLevels ()
 
void SetGrantableLevels (uint8 val)
 
ReputationMgrGetReputationMgr ()
 
ReputationMgr const & GetReputationMgr () const
 
ReputationRank GetReputationRank (uint32 faction_id) const
 
void RewardReputation (Unit *victim)
 
void RewardReputation (Quest const *quest)
 
float CalculateReputationGain (ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus=false)
 
void UpdateSkillsForLevel ()
 
void UpdateSkillsToMaxSkillsForLevel ()
 
void ModifySkillBonus (uint32 skillid, int32 val, bool talent)
 
void RewardExtraBonusTalentPoints (uint32 bonusTalentPoints)
 
void UpdateHonorFields ()
 
bool RewardHonor (Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
 
uint32 GetHonorPoints () const
 
uint32 GetArenaPoints () const
 
void ModifyHonorPoints (int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
 
void ModifyArenaPoints (int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
 If trans is specified, honor save query will be added to trans.
 
uint32 GetMaxPersonalArenaRatingRequirement (uint32 minarenaslot) const
 If trans is specified, arena point save query will be added to trans.
 
void SetHonorPoints (uint32 value)
 
void SetArenaPoints (uint32 value)
 
void SaveHealthBeforeDuel ()
 
void SaveManaBeforeDuel ()
 
void RestoreHealthAfterDuel ()
 
void RestoreManaAfterDuel ()
 
SpellCooldowns GetSpellCooldowns () const
 
void SetDrunkValue (uint8 newDrunkValue, uint32 itemId=0)
 
uint8 GetDrunkValue () const
 
int32 GetFakeDrunkValue () const
 
void UpdateInvisibilityDrunkDetect ()
 
uint32 GetDeathTimer () const
 
uint32 GetCorpseReclaimDelay (bool pvp) const
 
void UpdateCorpseReclaimDelay ()
 
int32 CalculateCorpseReclaimDelay (bool load=false)
 
void SendCorpseReclaimDelay (uint32 delay)
 
uint32 GetShieldBlockValue () const override
 
bool CanParry () const
 
void SetCanParry (bool value)
 
bool CanBlock () const
 
void SetCanBlock (bool value)
 
bool CanTitanGrip () const
 
void SetCanTitanGrip (bool value)
 
bool CanTameExoticPets () const
 
void SetRegularAttackTime ()
 
void SetBaseModValue (BaseModGroup modGroup, BaseModType modType, float value)
 
void HandleBaseModValue (BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
 
float GetBaseModValue (BaseModGroup modGroup, BaseModType modType) const
 
float GetTotalBaseModValue (BaseModGroup modGroup) const
 
float GetTotalPercentageModValue (BaseModGroup modGroup) const
 
void _ApplyAllStatBonuses ()
 
void _RemoveAllStatBonuses ()
 
void ResetAllPowers ()
 
SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const override
 
void _ApplyWeaponDependentAuraMods (Item *item, WeaponAttackType attackType, bool apply)
 
void _ApplyWeaponDependentAuraCritMod (Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
 
void _ApplyWeaponDependentAuraDamageMod (Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
 
void _ApplyItemMods (Item *item, uint8 slot, bool apply)
 
void _RemoveAllItemMods ()
 
void _ApplyAllItemMods ()
 
void _ApplyAllLevelScaleItemMods (bool apply)
 
void _ApplyItemBonuses (ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale=false)
 
void _ApplyWeaponDamage (uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
 
void _ApplyAmmoBonuses ()
 
bool EnchantmentFitsRequirements (uint32 enchantmentcondition, int8 slot)
 
void ToggleMetaGemsActive (uint8 exceptslot, bool apply)
 
void CorrectMetaGemEnchants (uint8 slot, bool apply)
 
void InitDataForForm (bool reapplyMods=false)
 
void ApplyItemEquipSpell (Item *item, bool apply, bool form_change=false)
 
void ApplyEquipSpell (SpellInfo const *spellInfo, Item *item, bool apply, bool form_change=false)
 
void UpdateEquipSpellsAtFormChange ()
 
void CastItemCombatSpell (Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
 
void CastItemUseSpell (Item *item, SpellCastTargets const &targets, uint8 cast_count, uint32 glyphIndex)
 
void CastItemCombatSpell (Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemTemplate const *proto)
 
void SendEquipmentSetList ()
 
void SetEquipmentSet (uint32 index, EquipmentSet eqset)
 
void DeleteEquipmentSet (uint64 setGuid)
 
void SendInitWorldStates (uint32 zoneId, uint32 areaId)
 
void SendUpdateWorldState (uint32 variable, uint32 value) const
 
void SendDirectMessage (WorldPacket const *data) const
 
void SendBGWeekendWorldStates ()
 
void SendBattlefieldWorldStates ()
 
void GetAurasForTarget (Unit *target, bool force=false)
 
void SendLoot (ObjectGuid guid, LootType loot_type)
 
void SendLootError (ObjectGuid guid, LootError error)
 
void SendLootRelease (ObjectGuid guid)
 
void SendNotifyLootItemRemoved (uint8 lootSlot)
 
void SendNotifyLootMoneyRemoved ()
 
bool InBattleground () const
 
bool InArena () const
 
uint32 GetBattlegroundId () const
 
BattlegroundTypeId GetBattlegroundTypeId () const
 
uint32 GetCurrentBattlegroundQueueSlot () const
 
bool IsInvitedForBattlegroundInstance () const
 
bool IsCurrentBattlegroundRandom () const
 
BGDataGetBGData ()
 
void SetBGData (BGData &bgdata)
 
BattlegroundGetBattleground (bool create=false) const
 
bool InBattlegroundQueue (bool ignoreArena=false) const
 
bool IsDeserter () const
 
BattlegroundQueueTypeId GetBattlegroundQueueTypeId (uint32 index) const
 
uint32 GetBattlegroundQueueIndex (BattlegroundQueueTypeId bgQueueTypeId) const
 
bool IsInvitedForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId) const
 
bool InBattlegroundQueueForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId) const
 
void SetBattlegroundId (uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
 
uint32 AddBattlegroundQueueId (BattlegroundQueueTypeId val)
 
bool HasFreeBattlegroundQueueId () const
 
void RemoveBattlegroundQueueId (BattlegroundQueueTypeId val)
 
void SetInviteForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId)
 
bool IsInvitedForBattlegroundInstance (uint32 instanceId) const
 
TeamId GetBgTeamId () const
 
void LeaveBattleground (Battleground *bg=nullptr)
 
bool CanJoinToBattleground () const
 
bool CanReportAfkDueToLimit ()
 
void ReportedAfkBy (Player *reporter)
 This player has been blamed to be inactive in a battleground.
 
void ClearAfkReports ()
 
bool GetBGAccessByLevel (BattlegroundTypeId bgTypeId) const
 
bool CanUseBattlegroundObject (GameObject *gameobject) const
 
bool isTotalImmune () const
 
bool CanCaptureTowerPoint () const
 
bool GetRandomWinner ()
 
void SetRandomWinner (bool isWinner)
 
OutdoorPvPGetOutdoorPvP () const
 
bool IsOutdoorPvPActive ()
 
bool IsImmuneToEnvironmentalDamage ()
 
uint32 EnvironmentalDamage (EnviromentalDamage type, uint32 damage)
 
void UpdateSpeakTime (ChatFloodThrottle::Index index)
 
bool CanSpeak () const
 
void UpdateFallInformationIfNeed (MovementInfo const &minfo, uint16 opcode)
 
void SetFallInformation (uint32 time, float z)
 
void HandleFall (MovementInfo const &movementInfo)
 
bool canFlyInZone (uint32 mapid, uint32 zone, SpellInfo const *bySpell)
 
void SetClientControl (Unit *target, bool allowMove, bool packetOnly=false)
 
void SetMover (Unit *target)
 
void SetSeer (WorldObject *target)
 
void SetViewpoint (WorldObject *target, bool apply)
 
WorldObjectGetViewpoint () const
 
void StopCastingCharm (Aura *except=nullptr)
 
void StopCastingBindSight (Aura *except=nullptr)
 
uint32 GetSaveTimer () const
 
void SetSaveTimer (uint32 timer)
 
void SaveRecallPosition ()
 
void SetHomebind (WorldLocation const &loc, uint32 areaId)
 
WorldLocation GetStartPosition () const
 
WorldLocation const & GetEntryPoint () const
 
void SetEntryPoint ()
 
bool HaveAtClient (WorldObject const *u) const
 
bool HaveAtClient (ObjectGuid guid) const
 
bool IsNeverVisible () const override
 
bool IsVisibleGloballyFor (Player const *player) const
 
void GetInitialVisiblePackets (Unit *target)
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void UpdateVisibilityForPlayer (bool mapChange=false)
 
void UpdateVisibilityOf (WorldObject *target)
 
void UpdateTriggerVisibility ()
 
template<class T >
void UpdateVisibilityOf (T *target, UpdateData &data, std::vector< Unit * > &visibleNow)
 
bool HasAtLoginFlag (AtLoginFlags f) const
 
void SetAtLoginFlag (AtLoginFlags f)
 
void RemoveAtLoginFlag (AtLoginFlags flags, bool persist=false)
 
bool IsUsingLfg ()
 
bool inRandomLfgDungeon ()
 
uint32 GetTemporaryUnsummonedPetNumber () const
 
void SetTemporaryUnsummonedPetNumber (uint32 petnumber)
 
void UnsummonPetTemporaryIfAny ()
 
void ResummonPetTemporaryUnSummonedIfAny ()
 
bool IsPetNeedBeTemporaryUnsummoned () const
 
bool CanResummonPet (uint32 spellid)
 
void SendCinematicStart (uint32 CinematicSequenceId) const
 
void SendMovieStart (uint32 MovieId)
 
uint32 DoRandomRoll (uint32 minimum, uint32 maximum)
 
uint16 GetMaxSkillValueForLevel () const
 
bool IsFFAPvP ()
 
bool IsPvP ()
 
void UpdateHomebindTime (uint32 time)
 
void BindToInstance ()
 
void SetPendingBind (uint32 instanceId, uint32 bindTimer)
 
bool HasPendingBind () const
 
uint32 GetPendingBind () const
 
void SendRaidInfo ()
 
void SendSavedInstances ()
 
void PrettyPrintRequirementsQuestList (const std::vector< const ProgressionRequirement * > &missingQuests) const
 
void PrettyPrintRequirementsAchievementsList (const std::vector< const ProgressionRequirement * > &missingAchievements) const
 
void PrettyPrintRequirementsItemsList (const std::vector< const ProgressionRequirement * > &missingItems) const
 
bool Satisfy (DungeonProgressionRequirements const *ar, uint32 target_map, bool report=false)
 
bool CheckInstanceLoginValid ()
 
bool CheckInstanceCount (uint32 instanceId) const
 
void AddInstanceEnterTime (uint32 instanceId, time_t enterTime)
 
uint32 GetLastPetNumber () const
 
void SetLastPetNumber (uint32 petnumber)
 
uint32 GetLastPetSpell () const
 
void SetLastPetSpell (uint32 petspell)
 
GroupGetGroupInvite ()
 
void SetGroupInvite (Group *group)
 
GroupGetGroup ()
 
const GroupGetGroup () const
 
GroupReferenceGetGroupRef ()
 
void SetGroup (Group *group, int8 subgroup=-1)
 
uint8 GetSubGroup () const
 
uint32 GetGroupUpdateFlag () const
 
void SetGroupUpdateFlag (uint32 flag)
 
uint64 GetAuraUpdateMaskForRaid () const
 
void SetAuraUpdateMaskForRaid (uint8 slot)
 
PlayerGetNextRandomRaidMember (float radius)
 
PartyResult CanUninviteFromGroup (ObjectGuid targetPlayerGUID=ObjectGuid::Empty) const
 
void SetBattlegroundOrBattlefieldRaid (Group *group, int8 subgroup=-1)
 
void RemoveFromBattlegroundOrBattlefieldRaid ()
 
GroupGetOriginalGroup ()
 
GroupReferenceGetOriginalGroupRef ()
 
uint8 GetOriginalSubGroup () const
 
void SetOriginalGroup (Group *group, int8 subgroup=-1)
 
void SetPassOnGroupLoot (bool bPassOnGroupLoot)
 
bool GetPassOnGroupLoot () const
 
MapReferenceGetMapRef ()
 
void SetMap (Map *map) override
 
void ResetMap () override
 
bool CanTeleport ()
 
void SetCanTeleport (bool value)
 
bool CanKnockback ()
 
void SetCanKnockback (bool value)
 
bool isAllowedToLoot (Creature const *creature)
 
DeclinedName const * GetDeclinedNames () const
 
uint8 GetRunesState () const
 
RuneType GetBaseRune (uint8 index) const
 
RuneType GetCurrentRune (uint8 index) const
 
uint32 GetRuneCooldown (uint8 index) const
 
uint32 GetGracePeriod (uint8 index) const
 
uint32 GetRuneBaseCooldown (uint8 index, bool skipGrace)
 
bool IsBaseRuneSlotsOnCooldown (RuneType runeType) const
 
RuneType GetLastUsedRune ()
 
void SetLastUsedRune (RuneType type)
 
void SetBaseRune (uint8 index, RuneType baseRune)
 
void SetCurrentRune (uint8 index, RuneType currentRune)
 
void SetRuneCooldown (uint8 index, uint32 cooldown)
 
void SetGracePeriod (uint8 index, uint32 period)
 
void SetRuneConvertAura (uint8 index, AuraEffect const *aura)
 
void AddRuneByAuraEffect (uint8 index, RuneType newType, AuraEffect const *aura)
 
void RemoveRunesByAuraEffect (AuraEffect const *aura)
 
void RestoreBaseRune (uint8 index)
 
void ConvertRune (uint8 index, RuneType newType)
 
void ResyncRunes (uint8 count)
 
void AddRunePower (uint8 index)
 
void InitRunes ()
 
void SendRespondInspectAchievements (Player *player) const
 
bool HasAchieved (uint32 achievementId) const
 
void ResetAchievements ()
 
void CheckAllAchievementCriteria ()
 
void ResetAchievementCriteria (AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
 
void UpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
 
void RemoveTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void CompletedAchievement (AchievementEntry const *entry)
 
AchievementMgrGetAchievementMgr () const
 
void SetCreationTime (Seconds creationTime)
 
Seconds GetCreationTime () const
 
bool HasTitle (uint32 bitIndex) const
 
bool HasTitle (CharTitlesEntry const *title) const
 
void SetTitle (CharTitlesEntry const *title, bool lost=false)
 
void SetCurrentTitle (CharTitlesEntry const *title, bool clear=false)
 
bool CanSeeSpellClickOn (Creature const *creature) const
 
bool CanSeeVendor (Creature const *creature) const
 
uint32 GetChampioningFaction () const
 
void SetChampioningFaction (uint32 faction)
 
float GetAverageItemLevel ()
 
float GetAverageItemLevelForDF ()
 
void ClearWhisperWhiteList ()
 
void AddWhisperWhiteList (ObjectGuid guid)
 
bool IsInWhisperWhiteList (ObjectGuid guid)
 
void RemoveFromWhisperWhiteList (ObjectGuid guid)
 
bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool SetCanFly (bool apply, bool packetOnly=false) override
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().
 
bool SetWaterWalking (bool apply, bool packetOnly=false) override
 Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.
 
bool SetFeatherFall (bool apply, bool packetOnly=false) override
 
bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool CanFly () const override
 
bool CanEnterWater () const override
 
void AdditionalSavingAddMask (uint8 mask)
 
bool IsSpectator () const
 
void SetIsSpectator (bool on)
 
bool NeedSendSpectatorData () const
 
void SetPendingSpectatorForBG (uint32 bgInstanceId)
 
bool HasPendingSpectatorForBG (uint32 bgInstanceId) const
 
void SetPendingSpectatorInviteInstanceId (uint32 bgInstanceId)
 
uint32 GetPendingSpectatorInviteInstanceId () const
 
bool HasReceivedSpectatorResetFor (ObjectGuid guid)
 
void ClearReceivedSpectatorResetFor ()
 
void AddReceivedSpectatorResetFor (ObjectGuid guid)
 
void RemoveReceivedSpectatorResetFor (ObjectGuid guid)
 
void setRuneWeaponGUID (ObjectGuid guid)
 
ObjectGuid getRuneWeaponGUID ()
 
bool CanSeeDKPet () const
 
void SetShowDKPet (bool on)
 
void PrepareCharmAISpells ()
 
bool NeedToSaveGlyphs ()
 
void SetNeedToSaveGlyphs (bool val)
 
uint32 GetMountBlockId ()
 
void SetMountBlockId (uint32 mount)
 
float GetRealParry () const
 
float GetRealDodge () const
 
const PlayerTalentMapGetTalentMap () const
 
uint32 GetNextSave () const
 
SpellModList const & GetSpellModList (uint32 type) const
 
void SetServerSideVisibility (ServerSideVisibilityType type, AccountTypes sec)
 
void SetServerSideVisibilityDetect (ServerSideVisibilityType type, AccountTypes sec)
 
void SetFarSightDistance (float radius)
 
void ResetFarSightDistance ()
 
Optional< float > GetFarSightDistance () const
 
float GetSightRange (WorldObject const *target=nullptr) const override
 
std::string GetPlayerName ()
 
PlayerSetting GetPlayerSetting (std::string const &source, uint8 index)
 
void UpdatePlayerSetting (std::string const &source, uint8 index, uint32 value)
 
void SendSystemMessage (std::string_view msg, bool escapeCharacters=false)
 
std::string GetDebugInfo () const override
 
const PendingSpellCastRequestGetCastRequest (uint32 category) const
 
bool CanExecutePendingSpellCastRequest (SpellInfo const *spellInfo)
 
void ExecuteOrCancelSpellCastRequest (PendingSpellCastRequest *castRequest, bool isCancel=false)
 
bool CanRequestSpellCast (SpellInfo const *spellInfo)
 
- Public Member Functions inherited from Unit
 ~Unit () override
 
void Update (uint32 time) override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
bool IsDuringRemoveFromWorld () const
 
void SetUInt32Value (uint16 index, uint32 value)
 
UnitGetOwner () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
ObjectGuid GetTransGUID () const override
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only.
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
void SetEmoteState (Emote emoteState)
 
void ClearEmoteState ()
 Sets emote state (looping emote). Emotes available in SharedDefines.h.
 
NPCFlags GetNpcFlags () const
 Clears emote state (looping emote)
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
bool IsCritter () const
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
uint32 GetFaction () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
void SetFaction (uint32 faction)
 
void RestoreFaction ()
 
uint32 GetOldFactionId () const
 
ObjectGuid GetTarget () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
float GetBoundaryRadius () const
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinBoundaryRadius (const Unit *obj) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells.
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
bool HasMainhandWeapon () const
 
bool HasOffhandWeapon () const
 
bool HasRangedWeapon () const
 
bool hasMainhandWeaponForAttack () const
 
bool HasMainhandWeaponForAttack () const
 
bool HasOffhandWeaponForAttack () const
 
bool HasRangedWeaponForAttack () const
 
bool CanUseAttackType (uint8 attacktype) const
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
bool IsContestedGuard () const
 
bool RespondsToCallForHelp () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
float GetCreateStat (Stats stat) const
 
void SetCreateStat (Stats stat, float val)
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
void InitStatBuffMods ()
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
void SetCanModifyStats (bool modifyStats)
 
bool CanModifyStats () const
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
float GetHealthPct () const
 
int32 GetHealthGain (int32 dVal)
 
uint32 GetCreateHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
void SetCreateHealth (uint32 val)
 
Powers getPowerType () const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
uint32 GetCreatePowers (Powers power) const
 
void setPowerType (Powers power)
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
uint32 GetCreateMana () const
 
void SetCreateMana (uint32 val)
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
bool CanApplyResilience () const
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
uint32 GetResistance (SpellSchoolMask mask) const
 
uint32 GetResistance (SpellSchools school) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistance (SpellSchools school, int32 val)
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void UpdateAllResistances ()
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, bool npcCaster) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
PlayerGetAffectingPlayer () const
 
UnitGetFirstControlled () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
void SetCharm (Unit *target, bool apply)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void UpdateCharmAI ()
 
void RemoveCharmedBy (Unit *charmer)
 
void RemoveCharmAuras ()
 
void RemoveAllControlled (bool onDeath=false)
 
void DeleteCharmInfo ()
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveBindSightAuras ()
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuras (SearchMethod sm, std::vector< uint32 > &spellIds) const
 Check if unit has ANY or ALL specified auras.
 
template<typename... Auras>
bool HasAnyAuras (Auras... spellIds) const
 Checks if the unit has ANY specified auras.
 
template<typename... Auras>
bool HasAllAuras (Auras... spellIds) const
 Checks if the unit has ALL specified auras.
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
PlayerGetSpellModOwner () const
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellGetFirstCurrentCastingSpell () const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool IsInFlight () const
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool IsMovementPreventedByCasting () const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool CanFreeMove () const
 
bool HasLeewayMovement () const
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
void propagateSpeedChange ()
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetSwim (bool enable)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
SheathState GetSheath () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
DeathState getDeathState ()
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
bool HasGhostAura () const
 
bool HasMountedAura () const
 
bool HasWaterWalkAura () const
 
bool HasFeatherFallAura () const
 
bool HasHoverAura () const
 
bool HasFlyAura () const
 
bool HasSpiritOfRedemptionAura () const
 
bool HasPreventsFleeingAura () const
 
bool HasPreventDurabilityLossAura () const
 
bool HasPreventResurectionAura () const
 
bool HasTransformAura () const
 
bool HasInterruptRegenAura () const
 
bool HasNoPVPCreditAura () const
 
bool HasWaterBreathingAura () const
 
bool HasIgnoreHitDirectionAura () const
 
bool HasSpellMagnetAura () const
 
bool HasOpenStableAura () const
 
bool HasCloneCasterAura () const
 
bool HasReflectSpellsAura () const
 
bool HasDetectAmoreAura () const
 
bool HasAllowOnlyAbilityAura () const
 
bool HasPeriodicDummyAura () const
 
bool HasControlVehicleAura () const
 
bool HasAOECharmAura () const
 
bool HasDetectSpellsAura () const
 
bool HasPacifySilenceAura () const
 
bool HasSilenceAura () const
 
bool HasShapeshiftAura () const
 
bool HasDecreaseSpeedAura () const
 
bool HasPacifyAura () const
 
bool HasIgnoreTargetResistAura () const
 
bool HasIncreaseMountedSpeedAura () const
 
bool HasIncreaseMountedFlightSpeedAura () const
 
bool HasThreatAura () const
 
bool HasAttackerSpellCritChanceAura () const
 
bool HasUnattackableAura () const
 
bool HasHealthRegenInCombatAura () const
 
bool HasRegenDuringCombatAura () const
 
bool HasFearAura () const
 
bool HasConfuseAura () const
 
bool HasRootAura () const
 
bool HasStunAura () const
 
bool HasTauntAura () const
 
bool HasStealthAura () const
 
bool HasStealthDetectAura () const
 
bool HasInvisibilityAura () const
 
bool HasInvisibilityDetectAura () const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
void UpdateAuraForGroup (uint8 slot)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
bool IsInDisallowedMountForm () const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
virtual float GetFollowAngle () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
CreatureGetCompanionPet () const
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
void UnsummonAllTotems (bool onDeath=false)
 
TransportBaseGetDirectTransport () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void HandleEmoteCommand (uint32 emoteId)
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsAttackSpeedOverridenShapeShift () const
 
bool IsInFeralForm () const
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void DeMorph ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, float displayScale=1.f)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId)
 
virtual bool IsUnderWater () const
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SetTimedFacingToObject (WorldObject *object, uint32 time)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
float GetCollisionHeight () const override
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendComboPoints ()
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------—
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
void OutDebugInfo () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
template<typename Worker >
void DoForAllVisiblePlayers (Worker &&worker)
 
template<typename Worker >
void DoForAllVisibleWorldObjects (Worker &&worker)
 
void DestroyForVisiblePlayers ()
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (Position pos, float *ground=nullptr) const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
virtual bool IsUpdateNeeded ()
 
bool CanBeAddedToMapUpdateList ()
 
std::string GetDebugInfo () const override
 
ObjectVisibilityContainerGetObjectVisibilityContainer ()
 
ObjectVisibilityContainer const & GetObjectVisibilityContainer () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
template<typename... T>
bool EntryEquals (T... entries) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
bool operator!= (Position const &a) const
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Player >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< Player > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static bool BuildEnumData (PreparedQueryResult result, WorldPacket *data)
 
static uint8 GetAttackBySlot (uint8 slot)
 
static bool IsInventoryPos (uint16 pos)
 
static bool IsInventoryPos (uint8 bag, uint8 slot)
 
static bool IsEquipmentPos (uint16 pos)
 
static bool IsEquipmentPos (uint8 bag, uint8 slot)
 
static bool IsBagPos (uint16 pos)
 
static bool IsBankPos (uint16 pos)
 
static bool IsBankPos (uint8 bag, uint8 slot)
 
static uint32 GetDefaultGossipMenuForSource (WorldObject *source)
 
static uint32 GetZoneIdFromDB (ObjectGuid guid)
 
static bool LoadPositionFromDB (uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, ObjectGuid::LowType guid)
 
static bool IsValidGender (uint8 Gender)
 
static void Customize (CharacterCustomizeInfo const *customizeInfo, CharacterDatabaseTransaction trans)
 
static void SavePositionInDB (uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
 
static void SavePositionInDB (WorldLocation const &loc, uint16 zoneId, ObjectGuid guid, CharacterDatabaseTransaction trans)
 
static void DeleteFromDB (ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
 
static void DeleteOldCharacters ()
 
static void DeleteOldCharacters (uint32 keepDays)
 
static void DeleteOldRecoveryItems ()
 
static void DeleteOldRecoveryItems (uint32 keepDays)
 
static void RemoveFromGroup (Group *group, ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
 
static void RemovePetitionsAndSigns (ObjectGuid guid, uint32 type)
 
static uint32 GetArenaTeamIdFromDB (ObjectGuid guid, uint8 slot)
 
static void LeaveAllArenaTeams (ObjectGuid guid)
 
static void ResetInstances (ObjectGuid guid, uint8 method, bool isRaid)
 Reset all solo instances and optionally send a message on success for each.
 
static void OfflineResurrect (ObjectGuid const guid, CharacterDatabaseTransaction trans)
 
static TeamId TeamIdForRace (uint8 race)
 
static DrunkenState GetDrunkenstateByValue (uint8 value)
 
- Static Public Member Functions inherited from Unit
static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

std::string autoReplyMsg
 
PlayerTaxi m_taxi
 
time_t m_logintime
 
time_t m_Last_tick
 
uint32 m_Played_time [MAX_PLAYED_TIME_INDEX]
 
bool m_mailsUpdated
 
uint8 unReadMails
 
time_t m_nextMailDelivereTime
 
ItemMap mMitems
 
PvPInfo pvpInfo
 
std::unique_ptr< DuelInfoduel
 
PlayerMenuPlayerTalkClass
 
std::vector< ItemSetEffect * > ItemSetEff
 
SafeUnitPointer m_mover
 
WorldObjectm_seer
 
std::set< Unit * > m_isInSharedVisionOf
 
uint32 m_recallMap
 
float m_recallX
 
float m_recallY
 
float m_recallZ
 
float m_recallO
 
uint32 m_homebindMapId
 
uint16 m_homebindAreaId
 
float m_homebindX
 
float m_homebindY
 
float m_homebindZ
 
std::vector< Unit * > m_newVisible
 
uint8 m_forced_speed_changes [MAX_MOVE_TYPE]
 
DFQuestsDoneList m_DFQuests
 
uint32 m_HomebindTimer
 
bool m_InstanceValid
 
Spellm_spellModTakingSpell
 
bool isDebugAreaTriggers
 
uint32 m_pendingSpectatorForBG
 
uint32 m_pendingSpectatorInviteInstanceId
 
GuidSet m_receivedSpectatorResetFor
 
ObjectGuid m_drwGUID
 
uint32 m_charmUpdateTimer
 
std::deque< PendingSpellCastRequestSpellQueue
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Static Public Attributes

static std::unordered_map< int, bgZoneRefbgZoneIdToFillWorldStates = {}
 

Protected Types

typedef std::set< uint32QuestSet
 
typedef std::set< uint32SeasonalQuestSet
 
typedef std::unordered_map< uint32, SeasonalQuestSetSeasonalEventQuestMap
 
typedef std::list< Channel * > JoinedChannelsList
 
- Protected Types inherited from Unit
typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

uint32 GetSpellQueueWindow () const
 
void ProcessSpellQueue ()
 
void _LoadActions (PreparedQueryResult result)
 
void _LoadAuras (PreparedQueryResult result, uint32 timediff)
 
void _LoadGlyphAuras ()
 
void _LoadInventory (PreparedQueryResult result, uint32 timeDiff)
 
void _LoadMail (PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
 
void _LoadQuestStatus (PreparedQueryResult result)
 
void _LoadQuestStatusRewarded (PreparedQueryResult result)
 
void _LoadDailyQuestStatus (PreparedQueryResult result)
 
void _LoadWeeklyQuestStatus (PreparedQueryResult result)
 
void _LoadMonthlyQuestStatus (PreparedQueryResult result)
 
void _LoadSeasonalQuestStatus (PreparedQueryResult result)
 
void _LoadRandomBGStatus (PreparedQueryResult result)
 
void _LoadGroup ()
 
void _LoadSkills (PreparedQueryResult result)
 
void _LoadSpells (PreparedQueryResult result)
 
void _LoadFriendList (PreparedQueryResult result)
 
bool _LoadHomeBind (PreparedQueryResult result)
 
void _LoadDeclinedNames (PreparedQueryResult result)
 
void _LoadArenaTeamInfo ()
 
void _LoadEquipmentSets (PreparedQueryResult result)
 
void _LoadEntryPointData (PreparedQueryResult result)
 
void _LoadGlyphs (PreparedQueryResult result)
 
void _LoadTalents (PreparedQueryResult result)
 
void _LoadInstanceTimeRestrictions (PreparedQueryResult result)
 
void _LoadBrewOfTheMonth (PreparedQueryResult result)
 
void _LoadCharacterSettings (PreparedQueryResult result)
 
void _LoadPetStable (uint8 petStableSlots, PreparedQueryResult result)
 
void _SaveActions (CharacterDatabaseTransaction trans)
 
void _SaveAuras (CharacterDatabaseTransaction trans, bool logout)
 
void _SaveInventory (CharacterDatabaseTransaction trans)
 
void _SaveMail (CharacterDatabaseTransaction trans)
 
void _SaveQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveDailyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveWeeklyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveMonthlyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveSeasonalQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveSpells (CharacterDatabaseTransaction trans)
 
void _SaveEquipmentSets (CharacterDatabaseTransaction trans)
 
void _SaveEntryPoint (CharacterDatabaseTransaction trans)
 
void _SaveGlyphs (CharacterDatabaseTransaction trans)
 
void _SaveTalents (CharacterDatabaseTransaction trans)
 
void _SaveStats (CharacterDatabaseTransaction trans)
 
void _SaveCharacter (bool create, CharacterDatabaseTransaction trans)
 
void _SaveInstanceTimeRestrictions (CharacterDatabaseTransaction trans)
 
void _SavePlayerSettings (CharacterDatabaseTransaction trans)
 
void HandleSobering ()
 The player sobers by 1% every 9 seconds.
 
void SendMirrorTimer (MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
 
void StopMirrorTimer (MirrorTimerType Type)
 
void HandleDrowning (uint32 time_diff)
 
int32 getMaxTimer (MirrorTimerType timer)
 
void outDebugValues () const
 
void SendQuestGiverStatusMultiple ()
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
- Protected Member Functions inherited from Unit
 Unit ()
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool CanSparringWith (Unit const *attacker) const
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 : Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject ()
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsInvisibleDueToDespawn () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
void AddToObjectUpdateIfNeeded ()
 

Static Protected Member Functions

static Item_LoadMailedItem (ObjectGuid const &playerGuid, Player *player, uint32 mailId, Mail *mail, Field *fields)
 

Protected Attributes

WhisperListContainer WhisperList
 
bool m_NeedToSaveGlyphs
 
uint32 m_MountBlockId
 
float m_realDodge
 
float m_realParry
 
uint32 m_charmAISpells [NUM_CAI_SPELLS]
 
uint32 m_AreaID
 
uint32 m_regenTimerCount
 
uint32 m_foodEmoteTimerCount
 
float m_powerFraction [MAX_POWERS]
 
uint32 m_contestedPvPTimer
 
std::array< BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES_BgBattlegroundQueueID
 
BGData m_bgData
 
bool m_IsBGRandomWinner
 
EntryPointData m_entryPointData
 
QuestSet m_timedquests
 
QuestSet m_weeklyquests
 
QuestSet m_monthlyquests
 
SeasonalEventQuestMap m_seasonalquests
 
ObjectGuid m_divider
 
uint32 m_ingametime
 
time_t m_lastHonorUpdateTime
 
ObjectGuid m_lootGuid
 
TeamId m_team
 
uint32 m_nextSave
 
uint16 m_additionalSaveTimer
 
uint8 m_additionalSaveMask
 
uint16 m_hostileReferenceCheckTimer
 
std::array< ChatFloodThrottle, ChatFloodThrottle::MAXm_chatFloodData
 
Difficulty m_dungeonDifficulty
 
Difficulty m_raidDifficulty
 
Difficulty m_raidMapDifficulty
 
uint32 m_atLoginFlags
 
Itemm_items [PLAYER_SLOTS_COUNT]
 
uint32 m_currentBuybackSlot
 
std::vector< Item * > m_itemUpdateQueue
 
bool m_itemUpdateQueueBlocked
 
uint32 m_ExtraFlags
 
QuestStatusMap m_QuestStatus
 
QuestStatusSaveMap m_QuestStatusSave
 
RewardedQuestSet m_RewardedQuests
 
QuestStatusSaveMap m_RewardedQuestsSave
 
SkillStatusMap mSkillStatus
 
uint32 m_GuildIdInvited
 
uint32 m_ArenaTeamIdInvited
 
PlayerMails m_mail
 
PlayerSpellMap m_spells
 
PlayerTalentMap m_talents
 
uint32 m_lastPotionId
 
GlobalCooldownMgr m_GlobalCooldownMgr
 
uint8 m_activeSpec
 
uint8 m_specsCount
 
uint32 m_Glyphs [MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]
 
ActionButtonList m_actionButtons
 
float m_auraBaseMod [BASEMOD_END][MOD_END]
 
int32 m_baseRatingValue [MAX_COMBAT_RATING]
 
uint32 m_baseSpellPower
 
uint32 m_baseSpellDamage
 
uint32 m_baseSpellHealing
 
uint32 m_baseFeralAP
 
uint32 m_baseManaRegen
 
uint32 m_baseHealthRegen
 
int32 m_spellPenetrationItemMod
 
SpellModList m_spellMods [MAX_SPELLMOD]
 
EnchantDurationList m_enchantDuration
 
ItemDurationList m_itemDuration
 
ItemDurationList m_itemSoulboundTradeable
 
std::mutex m_soulboundTradableLock
 
ObjectGuid m_resurrectGUID
 
uint32 m_resurrectMap
 
float m_resurrectX
 
float m_resurrectY
 
float m_resurrectZ
 
uint32 m_resurrectHealth
 
uint32 m_resurrectMana
 
WorldSessionm_session
 
JoinedChannelsList m_channels
 
uint8 m_cinematic
 
TradeDatam_trade
 
bool m_DailyQuestChanged
 
bool m_WeeklyQuestChanged
 
bool m_MonthlyQuestChanged
 
bool m_SeasonalQuestChanged
 
time_t m_lastDailyQuestTime
 
uint32 m_drunkTimer
 
uint32 m_weaponChangeTimer
 
uint32 m_zoneUpdateId
 
uint32 m_zoneUpdateTimer
 
uint32 m_areaUpdateId
 
uint32 m_deathTimer
 
time_t m_deathExpireTime
 
uint32 m_WeaponProficiency
 
uint32 m_ArmorProficiency
 
bool m_canParry
 
bool m_canBlock
 
bool m_canTitanGrip
 
uint8 m_swingErrorMsg
 
float m_ammoDPS
 
float m_Expertise
 
float m_OffhandExpertise
 
time_t _restTime
 
uint32 _innTriggerId
 
float _restBonus
 
uint32 _restFlagMask
 
uint32 m_resetTalentsCost
 
time_t m_resetTalentsTime
 
uint32 m_usedTalentCount
 
uint32 m_questRewardTalentCount
 
uint32 m_extraBonusTalentCount
 
PlayerSocialm_social
 
GroupReference m_group
 
GroupReference m_originalGroup
 
Groupm_groupInvite
 
uint32 m_groupUpdateMask
 
uint64 m_auraRaidUpdateMask
 
bool m_bPassOnGroupLoot
 
uint32 m_lastpetnumber
 
time_t m_summon_expire
 
uint32 m_summon_mapid
 
float m_summon_x
 
float m_summon_y
 
float m_summon_z
 
bool m_summon_asSpectator
 
DeclinedNamem_declinedname
 
Runesm_runes
 
EquipmentSets m_EquipmentSets
 
uint8 m_grantableLevels
 
bool m_needZoneUpdate
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union { 
 
   int32 *   m_int32Values 
 
   uint32 *   m_uint32Values 
 
   float *   m_floatValues 
 
};  
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef GuidSet RefundableItemsSet
 

Private Member Functions

InventoryResult CanStoreItem_InSpecificSlot (uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool swap, Item *pSrcItem) const
 
InventoryResult CanStoreItem_InBag (uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
 
InventoryResult CanStoreItem_InInventorySlots (uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
 
Item_StoreItem (uint16 pos, Item *pItem, uint32 count, bool clone, bool update)
 
Item_LoadItem (CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field *fields)
 
void SendRefundInfo (Item *item)
 
void RefundItem (Item *item)
 
void AddKnownCurrency (uint32 itemId)
 
void AdjustQuestReqItemCount (Quest const *quest, QuestStatusData &questStatusData)
 
bool MustDelayTeleport () const
 
void SetMustDelayTeleport (bool setting)
 
bool HasDelayedTeleport () const
 
void SetHasDelayedTeleport (bool setting)
 
void UpdateCharmedAI ()
 

Private Attributes

CinematicMgr_cinematicMgr
 
RefundableItemsSet m_refundableItems
 
MapReference m_mapRef
 
uint32 m_lastFallTime
 
float m_lastFallZ
 
int32 m_MirrorTimer [MAX_TIMERS]
 
uint8 m_MirrorTimerFlags
 
uint8 m_MirrorTimerFlagsLast
 
bool m_isInWater
 
WorldLocation teleportStore_dest
 
uint32 teleportStore_options
 
time_t mSemaphoreTeleport_Near
 
time_t mSemaphoreTeleport_Far
 
uint32 m_DelayedOperations
 
bool m_bMustDelayTeleport
 
bool m_bHasDelayedTeleport
 
bool m_canTeleport
 
bool m_canKnockback
 
std::unique_ptr< PetStablem_petStable
 
uint32 m_temporaryUnsummonedPetNumber
 
uint32 m_oldpetspell
 
AchievementMgrm_achievementMgr
 
ReputationMgrm_reputationMgr
 
SpellCooldowns m_spellCooldowns
 
uint32 m_ChampioningFaction
 
InstanceTimeMap _instanceResetTimes
 
uint32 _pendingBindId
 
uint32 _pendingBindTimer
 
uint32 _activeCheats
 
uint32 healthBeforeDuel
 
uint32 manaBeforeDuel
 
bool m_isInstantFlightOn
 
uint32 m_flightSpellActivated
 
WorldLocation _corpseLocation
 
Optional< float > _farSightDistance = { }
 
bool _wasOutdoor
 
PlayerSettingMap m_charSettingsMap
 
Seconds m_creationTime
 

Friends

class WorldSession
 
class CinematicMgr
 
void Item::AddToUpdateQueueOf (Player *player)
 
void Item::RemoveFromUpdateQueueOf (Player *player)
 

Detailed Description

Member Typedef Documentation

◆ DFQuestsDoneList

typedef std::set<uint32> Player::DFQuestsDoneList

◆ ItemMap

typedef std::unordered_map<ObjectGuid::LowType, Item*> Player::ItemMap

◆ JoinedChannelsList

typedef std::list<Channel*> Player::JoinedChannelsList
protected

◆ QuestSet

typedef std::set<uint32> Player::QuestSet
protected

◆ RefundableItemsSet

◆ SeasonalEventQuestMap

typedef std::unordered_map<uint32, SeasonalQuestSet> Player::SeasonalEventQuestMap
protected

◆ SeasonalQuestSet

typedef std::set<uint32> Player::SeasonalQuestSet
protected

Constructor & Destructor Documentation

◆ Player()

Player::Player ( WorldSession session)
explicit
152 : Unit(), m_mover(this)
153{
154#ifdef _MSC_VER
155#pragma warning(default:4355)
156#endif
157
160
162
163 m_session = session;
164
165 m_ingametime = 0;
166
167 m_ExtraFlags = 0;
168
169 m_spellModTakingSpell = nullptr;
170 //m_pad = 0;
171
172 // players always accept
174 SetAcceptWhispers(true);
175
179
180 m_regenTimer = 0;
184
187
188 m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
189
190 m_areaUpdateId = 0;
192
193 m_needZoneUpdate = false;
194
198
200
201 memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT);
202
203 m_social = nullptr;
204
205 // group is initialized in the reference constructor
206 SetGroupInvite(nullptr);
209 m_bPassOnGroupLoot = false;
210
213
215
218
220 m_bMustDelayTeleport = false;
221 m_bHasDelayedTeleport = false;
223 m_canTeleport = false;
224 m_canKnockback = false;
225
226 m_trade = nullptr;
227
228 m_cinematic = 0;
229
232
233 m_DailyQuestChanged = false;
235
236 for (uint8 i = 0; i < MAX_TIMERS; i++)
238
241 m_isInWater = false;
242 m_drunkTimer = 0;
243 m_deathTimer = 0;
245
247
248 m_swingErrorMsg = 0;
249
250 for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
251 {
253 _BgBattlegroundQueueID[j].invitedToInstance = 0;
254 }
255
262 m_canParry = false;
263 m_canBlock = false;
264 m_canTitanGrip = false;
265 m_ammoDPS = 0.0f;
266
268 //cache for UNIT_CREATED_BY_SPELL to allow
269 //returning reagents for temporarily removed pets
270 //when dying/logging out
271 m_oldpetspell = 0;
272 m_lastpetnumber = 0;
273
275 _restTime = 0;
276 _innTriggerId = 0;
277 _restBonus = 0;
278 _restFlagMask = 0;
280
281 m_mailsUpdated = false;
282 unReadMails = 0;
283 m_nextMailDelivereTime = time_t(0);
284
288
289 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
291
293
294 m_HomebindTimer = 0;
295 m_InstanceValid = true;
299
300 m_lastPotionId = 0;
301
302 m_activeSpec = 0;
303 m_specsCount = 1;
304
305 for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
306 {
307 for (uint8 g = 0; g < MAX_GLYPH_SLOT_INDEX; ++g)
308 m_Glyphs[i][g] = 0;
309 }
310
311 for (uint8 i = 0; i < BASEMOD_END; ++i)
312 {
313 m_auraBaseMod[i][FLAT_MOD] = 0.0f;
314 m_auraBaseMod[i][PCT_MOD] = 1.0f;
315 }
316
317 for (uint8 i = 0; i < MAX_COMBAT_RATING; i++)
318 m_baseRatingValue[i] = 0;
319
323 m_baseFeralAP = 0;
324 m_baseManaRegen = 0;
327
328 // Honor System
330
331 m_IsBGRandomWinner = false;
332
333 // Player summoning
334 m_summon_expire = 0;
335 m_summon_mapid = 0;
336 m_summon_x = 0.0f;
337 m_summon_y = 0.0f;
338 m_summon_z = 0.0f;
339 m_summon_asSpectator = false;
340
341 //m_mover = this;
343 m_seer = this;
344
345 m_recallMap = 0;
346 m_recallX = 0;
347 m_recallY = 0;
348 m_recallZ = 0;
349 m_recallO = 0;
350
351 m_homebindMapId = 0;
353 m_homebindX = 0;
354 m_homebindY = 0;
355 m_homebindZ = 0;
356
358
359 m_declinedname = nullptr;
360
361 m_isActive = true;
362
363 m_runes = nullptr;
364
365 m_lastFallTime = 0;
366 m_lastFallZ = 0;
367
369
371
372 sWorldSessionMgr->IncreasePlayerCount();
373
375
376 for (uint8 i = 0; i < MAX_POWERS; ++i)
377 m_powerFraction[i] = 0;
378
379 isDebugAreaTriggers = false;
380
381 m_WeeklyQuestChanged = false;
382
383 m_MonthlyQuestChanged = false;
384
386
387 SetPendingBind(0, 0);
388
390
391 m_creationTime = 0s;
392
393 _cinematicMgr = new CinematicMgr(this);
394
396 m_reputationMgr = new ReputationMgr(this);
397
398 m_NeedToSaveGlyphs = false;
399 m_MountBlockId = 0;
400 m_realDodge = 0.0f;
401 m_realParry = 0.0f;
404
406
407 for( int i = 0; i < NUM_CAI_SPELLS; ++i )
408 m_charmAISpells[i] = 0;
409
410 m_applyResilience = true;
411
412 m_isInstantFlightOn = true;
413
414 _wasOutdoor = true;
415
417
418 sScriptMgr->OnConstructPlayer(this);
419}
@ RAID_DIFFICULTY_10MAN_NORMAL
Definition DBCEnums.h:273
@ DUNGEON_DIFFICULTY_NORMAL
Definition DBCEnums.h:269
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
@ TYPEID_PLAYER
Definition ObjectGuid.h:36
@ TYPEMASK_PLAYER
Definition ObjectGuid.h:50
@ NUM_CAI_SPELLS
Definition Player.h:932
@ CHEAT_NONE
Definition Player.h:1005
@ BUYBACK_SLOT_START
Definition Player.h:731
#define MAX_TIMERS
Definition Player.h:584
#define DISABLED_MIRROR_TIMER
Definition Player.h:585
@ PLAYED_TIME_TOTAL
Definition Player.h:862
@ PLAYED_TIME_LEVEL
Definition Player.h:863
@ UNDERWATER_NONE
Definition Player.h:100
@ AT_LOGIN_NONE
Definition Player.h:606
@ PLAYER_SLOTS_COUNT
Definition Player.h:674
#define sScriptMgr
Definition ScriptMgr.h:727
@ MAX_POWERS
Definition SharedDefines.h:276
#define MAX_TALENT_SPECS
Definition SharedDefines.h:675
#define MAX_GLYPH_SLOT_INDEX
Definition SharedDefines.h:676
@ BATTLEGROUND_QUEUE_NONE
Definition SharedDefines.h:3875
@ TEAM_NEUTRAL
Definition SharedDefines.h:762
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition SharedDefines.h:176
#define MAX_MOVE_TYPE
Definition UnitDefines.h:360
@ FLAT_MOD
Definition Unit.h:190
@ PCT_MOD
Definition Unit.h:191
#define MAX_COMBAT_RATING
Definition Unit.h:245
@ BASEMOD_END
Definition Unit.h:185
@ PLAYER_END
Definition UpdateFields.h:392
@ CONFIG_INTERVAL_SAVE
Definition WorldConfig.h:164
#define sWorldSessionMgr
Definition WorldSessionMgr.h:110
Definition AchievementMgr.h:293
Definition Item.h:220
void InitForPlayer()
Definition ObjectVisibilityContainer.cpp:42
uint16 m_objectType
Definition Object.h:252
uint16 m_valuesCount
Definition Object.h:266
TypeID m_objectTypeId
Definition Object.h:254
Definition GossipDef.h:259
bool m_canParry
Definition Player.h:2891
time_t m_summon_expire
Definition Player.h:2927
bool m_needZoneUpdate
Definition Player.h:2944
uint16 m_additionalSaveTimer
Definition Player.h:2796
float m_ammoDPS
Definition Player.h:2895
uint32 m_temporaryUnsummonedPetNumber
Definition Player.h:2998
uint32 m_ChampioningFaction
Definition Player.h:3006
bool m_bHasDelayedTeleport
Definition Player.h:2991
bool m_InstanceValid
Definition Player.h:2453
time_t m_deathExpireTime
Definition Player.h:2887
ReputationMgr * m_reputationMgr
Definition Player.h:3002
float m_auraBaseMod[BASEMOD_END][MOD_END]
Definition Player.h:2840
float m_homebindZ
Definition Player.h:2391
uint32 m_lastFallTime
Definition Player.h:2975
uint32 m_lastPotionId
Definition Player.h:2829
CinematicMgr * _cinematicMgr
Definition Player.h:2954
bool m_canTeleport
Definition Player.h:2992
uint32 m_usedTalentCount
Definition Player.h:2908
friend class CinematicMgr
Definition Player.h:1085
bool m_MonthlyQuestChanged
Definition Player.h:2875
PlayerSocial * m_social
Definition Player.h:2913
uint32 m_homebindMapId
Definition Player.h:2387
Seconds m_creationTime
Definition Player.h:3030
void SetAcceptWhispers(bool on)
Definition Player.h:1176
float m_summon_z
Definition Player.h:2931
time_t m_lastHonorUpdateTime
Definition Player.h:2789
time_t _restTime
Definition Player.h:2901
SafeUnitPointer m_mover
Definition Player.h:2351
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition Player.h:2417
uint32 _activeCheats
Definition Player.h:3012
uint32 m_resetTalentsCost
Definition Player.h:2906
uint8 m_MirrorTimerFlags
Definition Player.h:2979
uint32 m_atLoginFlags
Definition Player.h:2804
uint32 m_ExtraFlags
Definition Player.h:2812
float m_recallX
Definition Player.h:2378
uint32 m_ingametime
Definition Player.h:2719
float m_recallO
Definition Player.h:2381
bool m_WeeklyQuestChanged
Definition Player.h:2874
uint8 unReadMails
Definition Player.h:1673
uint32 m_pendingSpectatorInviteInstanceId
Definition Player.h:2604
void SetGroupInvite(Group *group)
Definition Player.h:2484
uint32 m_DelayedOperations
Definition Player.h:2989
TradeData * m_trade
Definition Player.h:2871
float m_realParry
Definition Player.h:2675
uint32 m_nextSave
Definition Player.h:2795
uint32 m_zoneUpdateTimer
Definition Player.h:2883
bool m_mailsUpdated
Definition Player.h:1609
time_t mSemaphoreTeleport_Far
Definition Player.h:2987
float _restBonus
Definition Player.h:2903
uint32 m_foodEmoteTimerCount
Definition Player.h:2681
uint32 m_baseFeralAP
Definition Player.h:2845
float m_summon_y
Definition Player.h:2930
WorldObject * m_seer
Definition Player.h:2352
float m_summon_x
Definition Player.h:2929
uint32 m_charmAISpells[NUM_CAI_SPELLS]
Definition Player.h:2677
uint8 m_additionalSaveMask
Definition Player.h:2797
bool m_bMustDelayTeleport
Definition Player.h:2990
bool m_SeasonalQuestChanged
Definition Player.h:2876
TeamId m_team
Definition Player.h:2794
uint32 m_areaUpdateId
Definition Player.h:2884
uint8 m_specsCount
Definition Player.h:2834
uint32 m_extraBonusTalentCount
Definition Player.h:2910
WorldSession * GetSession() const
Definition Player.h:2016
float m_powerFraction[MAX_POWERS]
Definition Player.h:2682
uint32 m_oldpetspell
Definition Player.h:2999
Runes * m_runes
Definition Player.h:2935
uint32 m_currentBuybackSlot
Definition Player.h:2807
uint32 m_deathTimer
Definition Player.h:2886
uint32 m_regenTimerCount
Definition Player.h:2680
AchievementMgr * m_achievementMgr
Definition Player.h:3001
uint8 m_swingErrorMsg
Definition Player.h:2894
time_t m_nextMailDelivereTime
Definition Player.h:1674
std::array< BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES > _BgBattlegroundQueueID
Definition Player.h:2695
void clearResurrectRequestData()
Definition Player.h:1839
bool m_bPassOnGroupLoot
Definition Player.h:2921
float m_recallZ
Definition Player.h:2380
uint32 m_pendingSpectatorForBG
Definition Player.h:2603
bool m_DailyQuestChanged
Definition Player.h:2873
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]
Definition Player.h:2836
Difficulty m_dungeonDifficulty
Definition Player.h:2800
uint32 m_weaponChangeTimer
Definition Player.h:2880
uint32 m_WeaponProficiency
Definition Player.h:2889
float m_realDodge
Definition Player.h:2674
bool m_canKnockback
Definition Player.h:2993
bool m_isInstantFlightOn
Definition Player.h:3018
time_t mSemaphoreTeleport_Near
Definition Player.h:2986
DeclinedName * m_declinedname
Definition Player.h:2934
bool m_IsBGRandomWinner
Definition Player.h:2697
uint32 m_drunkTimer
Definition Player.h:2879
uint32 m_contestedPvPTimer
Definition Player.h:2683
uint32 m_baseSpellHealing
Definition Player.h:2844
float m_homebindY
Definition Player.h:2390
uint32 m_Played_time[MAX_PLAYED_TIME_INDEX]
Definition Player.h:1207
uint32 m_baseSpellPower
Definition Player.h:2842
bool _wasOutdoor
Definition Player.h:3026
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.h:2455
uint32 _restFlagMask
Definition Player.h:2904
uint8 m_grantableLevels
Definition Player.h:2942
Item * m_items[PLAYER_SLOTS_COUNT]
Definition Player.h:2806
uint16 m_homebindAreaId
Definition Player.h:2388
Difficulty m_raidMapDifficulty
Definition Player.h:2802
uint32 m_zoneUpdateId
Definition Player.h:2882
bool m_isInWater
Definition Player.h:2981
uint8 m_MirrorTimerFlagsLast
Definition Player.h:2980
time_t m_lastDailyQuestTime
Definition Player.h:2877
time_t m_resetTalentsTime
Definition Player.h:2907
uint32 m_baseHealthRegen
Definition Player.h:2847
uint32 m_charmUpdateTimer
Definition Player.h:2615
uint32 m_summon_mapid
Definition Player.h:2928
Difficulty m_raidDifficulty
Definition Player.h:2801
float m_lastFallZ
Definition Player.h:2976
bool m_summon_asSpectator
Definition Player.h:2932
uint32 m_baseManaRegen
Definition Player.h:2846
time_t m_logintime
Definition Player.h:1205
int32 m_MirrorTimer[MAX_TIMERS]
Definition Player.h:2978
uint32 _innTriggerId
Definition Player.h:2902
uint32 m_ArenaTeamIdInvited
Definition Player.h:2824
uint32 m_recallMap
Definition Player.h:2377
uint32 m_baseSpellDamage
Definition Player.h:2843
float m_recallY
Definition Player.h:2379
uint32 m_questRewardTalentCount
Definition Player.h:2909
bool m_NeedToSaveGlyphs
Definition Player.h:2670
uint32 m_HomebindTimer
Definition Player.h:2452
uint64 m_auraRaidUpdateMask
Definition Player.h:2920
bool m_canTitanGrip
Definition Player.h:2893
bool m_canBlock
Definition Player.h:2892
uint8 m_cinematic
Definition Player.h:2869
int32 m_spellPenetrationItemMod
Definition Player.h:2848
uint8 m_activeSpec
Definition Player.h:2833
WorldSession * m_session
Definition Player.h:2864
uint32 m_flightSpellActivated
Definition Player.h:3020
uint32 teleportStore_options
Definition Player.h:2985
int32 m_baseRatingValue[MAX_COMBAT_RATING]
Definition Player.h:2841
uint32 m_ArmorProficiency
Definition Player.h:2890
bool isDebugAreaTriggers
Definition Player.h:2573
uint32 m_groupUpdateMask
Definition Player.h:2919
Spell * m_spellModTakingSpell
Definition Player.h:2569
uint32 m_lastpetnumber
Definition Player.h:2924
time_t m_Last_tick
Definition Player.h:1206
PlayerMenu * PlayerTalkClass
Definition Player.h:2257
uint32 m_GuildIdInvited
Definition Player.h:2823
float m_homebindX
Definition Player.h:2389
uint16 m_hostileReferenceCheckTimer
Definition Player.h:2798
bool m_itemUpdateQueueBlocked
Definition Player.h:2810
uint32 m_MountBlockId
Definition Player.h:2672
Definition ReputationMgr.h:57
void Initialize(Unit *defVal)
Definition UnitUtils.h:51
int32 m_regenTimer
Definition Unit.h:2105
bool m_ControlledByPlayer
Definition Unit.h:2015
Unit()
Definition Unit.cpp:204
SafeUnitPointer m_movedByPlayer
Definition Unit.h:1992
bool m_applyResilience
Definition Unit.h:2118
bool m_isActive
Definition Object.h:721
ObjectVisibilityContainer & GetObjectVisibilityContainer()
Definition Object.h:712
#define sWorld
Definition World.h:320
bool IsPlayerAccount(uint32 gmlevel)
Definition AccountMgr.cpp:312
uint32 GetSecurity(uint32 accountId)
Definition AccountMgr.cpp:245
Seconds GetGameTime()
Definition GameTime.cpp:38

References _activeCheats, _BgBattlegroundQueueID, _cinematicMgr, _innTriggerId, _restBonus, _restFlagMask, _restTime, _wasOutdoor, AT_LOGIN_NONE, BASEMOD_END, BATTLEGROUND_QUEUE_NONE, BUYBACK_SLOT_START, CHEAT_NONE, CinematicMgr, clearResurrectRequestData(), CONFIG_INTERVAL_SAVE, DISABLED_MIRROR_TIMER, DUNGEON_DIFFICULTY_NORMAL, FLAT_MOD, GameTime::GetGameTime(), WorldObject::GetObjectVisibilityContainer(), GetSession(), ObjectVisibilityContainer::InitForPlayer(), SafeUnitPointer::Initialize(), isDebugAreaTriggers, AccountMgr::IsPlayerAccount(), m_achievementMgr, m_activeSpec, m_additionalSaveMask, m_additionalSaveTimer, m_ammoDPS, Unit::m_applyResilience, m_areaUpdateId, m_ArenaTeamIdInvited, m_ArmorProficiency, m_atLoginFlags, m_auraBaseMod, m_auraRaidUpdateMask, m_baseFeralAP, m_baseHealthRegen, m_baseManaRegen, m_baseRatingValue, m_baseSpellDamage, m_baseSpellHealing, m_baseSpellPower, m_bHasDelayedTeleport, m_bMustDelayTeleport, m_bPassOnGroupLoot, m_canBlock, m_canKnockback, m_canParry, m_canTeleport, m_canTitanGrip, m_ChampioningFaction, m_charmAISpells, m_charmUpdateTimer, m_cinematic, m_contestedPvPTimer, Unit::m_ControlledByPlayer, m_creationTime, m_currentBuybackSlot, m_DailyQuestChanged, m_deathExpireTime, m_deathTimer, m_declinedname, m_DelayedOperations, m_drunkTimer, m_dungeonDifficulty, m_extraBonusTalentCount, m_ExtraFlags, m_flightSpellActivated, m_foodEmoteTimerCount, m_forced_speed_changes, m_Glyphs, m_grantableLevels, m_groupUpdateMask, m_GuildIdInvited, m_homebindAreaId, m_homebindMapId, m_HomebindTimer, m_homebindX, m_homebindY, m_homebindZ, m_hostileReferenceCheckTimer, m_ingametime, m_InstanceValid, WorldObject::m_isActive, m_IsBGRandomWinner, m_isInstantFlightOn, m_isInWater, m_items, m_itemUpdateQueueBlocked, m_Last_tick, m_lastDailyQuestTime, m_lastFallTime, m_lastFallZ, m_lastHonorUpdateTime, m_lastpetnumber, m_lastPotionId, m_logintime, m_mailsUpdated, m_MirrorTimer, m_MirrorTimerFlags, m_MirrorTimerFlagsLast, m_MonthlyQuestChanged, m_MountBlockId, Unit::m_movedByPlayer, m_NeedToSaveGlyphs, m_needZoneUpdate, m_nextMailDelivereTime, m_nextSave, Object::m_objectType, Object::m_objectTypeId, m_oldpetspell, m_pendingSpectatorForBG, m_pendingSpectatorInviteInstanceId, m_Played_time, m_powerFraction, m_questRewardTalentCount, m_raidDifficulty, m_raidMapDifficulty, m_realDodge, m_realParry, m_recallMap, m_recallO, m_recallX, m_recallY, m_recallZ, Unit::m_regenTimer, m_regenTimerCount, m_reputationMgr, m_resetTalentsCost, m_resetTalentsTime, m_runes, m_SeasonalQuestChanged, m_seer, m_session, m_social, m_specsCount, m_spellModTakingSpell, m_spellPenetrationItemMod, m_summon_asSpectator, m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, m_swingErrorMsg, m_team, m_temporaryUnsummonedPetNumber, m_trade, m_usedTalentCount, Object::m_valuesCount, m_weaponChangeTimer, m_WeaponProficiency, m_WeeklyQuestChanged, m_zoneUpdateId, m_zoneUpdateTimer, MAX_COMBAT_RATING, MAX_GLYPH_SLOT_INDEX, MAX_MOVE_TYPE, MAX_POWERS, MAX_TALENT_SPECS, MAX_TIMERS, mSemaphoreTeleport_Far, mSemaphoreTeleport_Near, NUM_CAI_SPELLS, PCT_MOD, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER_END, PLAYER_MAX_BATTLEGROUND_QUEUES, PLAYER_SLOTS_COUNT, PlayerTalkClass, RAID_DIFFICULTY_10MAN_NORMAL, SetAcceptWhispers(), SetGroupInvite(), SetPendingBind(), sScriptMgr, sWorld, sWorldSessionMgr, TEAM_NEUTRAL, teleportStore_options, TYPEID_PLAYER, TYPEMASK_PLAYER, UNDERWATER_NONE, and unReadMails.

◆ ~Player()

Player::~Player ( )
override
422{
423 sScriptMgr->OnDestructPlayer(this);
424
425 // it must be unloaded already in PlayerLogout and accessed only for loggined player
426 //m_social = nullptr;
427
428 // Note: buy back item already deleted from DB when player was saved
429 for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i)
430 delete m_items[i];
431
432 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
433 delete itr->second;
434
435 for (PlayerTalentMap::const_iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
436 delete itr->second;
437
438 //all mailed items should be deleted, also all mail should be deallocated
439 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
440 {
441 delete *itr;
442 }
443
444 for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
445 delete iter->second; //if item is duplicated... then server may crash ... but that item should be deallocated
446
447 delete PlayerTalkClass;
448
449 for (std::size_t x = 0; x < ItemSetEff.size(); x++)
450 delete ItemSetEff[x];
451
452 delete m_declinedname;
453 delete m_runes;
454 delete m_achievementMgr;
455 delete m_reputationMgr;
456 delete _cinematicMgr;
457
458 sWorldSessionMgr->DecreasePlayerCount();
459
460 if (!m_isInSharedVisionOf.empty())
461 {
462 do
463 {
464 Unit* u = *(m_isInSharedVisionOf.begin());
465 u->RemovePlayerFromVision(this);
466 } while (!m_isInSharedVisionOf.empty());
467 }
468}
ItemMap mMitems
Definition Player.h:1678
PlayerSpellMap m_spells
Definition Player.h:2827
std::vector< ItemSetEffect * > ItemSetEff
Definition Player.h:2258
PlayerMails m_mail
Definition Player.h:2826
PlayerTalentMap m_talents
Definition Player.h:2828
std::set< Unit * > m_isInSharedVisionOf
Definition Player.h:2353
Definition Unit.h:620
void RemovePlayerFromVision(Player *player)
Definition Unit.cpp:11265

References _cinematicMgr, ItemSetEff, m_achievementMgr, m_declinedname, m_isInSharedVisionOf, m_items, m_mail, m_reputationMgr, m_runes, m_spells, m_talents, mMitems, PLAYER_SLOTS_COUNT, PlayerTalkClass, Unit::RemovePlayerFromVision(), sScriptMgr, and sWorldSessionMgr.

Member Function Documentation

◆ _addSpell()

bool Player::_addSpell ( uint32  spellId,
uint8  addSpecMask,
bool  temporary,
bool  learnFromSkill = false 
)
Todo:
confirm if rogues start wth lockpicking skill at level 1 but only recieve the spell to use it at level 16
3139{
3140 // pussywizard: this can be called to OVERWRITE currently existing spell params! usually to set active = false for lower ranks of a spell
3141
3142 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
3143 if (!SpellMgr::CheckSpellValid(spellInfo, spellId, false))
3144 return false;
3145
3146 // pussywizard: already found and temporary, nothing to do
3147 PlayerSpellMap::iterator itr = m_spells.find(spellId);
3148 if (itr != m_spells.end() && itr->second->State == PLAYERSPELL_TEMPORARY)
3149 return false;
3150
3151 // xinef: send packet so client can properly recognize this new spell
3152 // xinef: ignore passive spells and spells with learn effect
3153 // xinef: send spells with no aura effects (ie dual wield)
3154 if (IsInWorld() && !isBeingLoaded() && temporary && !learnFromSkill && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3155 SendLearnPacket(spellInfo->Id, true);
3156
3157 // xinef: DO NOT allow to learn spell with effect learn spell!
3158 // xinef: if spell possess spell learn effects only, learn those spells as temporary (eg. Metamorphosis, Tree of Life)
3159 if (temporary && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3160 {
3161 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3162 if (spellInfo->Effects[i].IsEffect())
3163 {
3164 if (spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
3165 {
3166 LOG_INFO("entities.player", "TRYING TO LEARN SPELL WITH EFFECT LEARN: {}, PLAYER: {}", spellId, GetGUID().ToString());
3167 return false;
3168 //ABORT();
3169 }
3170 else if (SpellInfo const* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell))
3172 }
3173
3174 return false;
3175 }
3176
3177 if (itr != m_spells.end()) // pussywizard: already know this spell, so update information
3178 {
3179 // pussywizard: do nothing if already set as wanted
3180 if (itr->second->State != PLAYERSPELL_REMOVED && (itr->second->specMask & addSpecMask) == addSpecMask)
3181 return false;
3182
3183 // pussywizard: need cast auras, learn linked spells, do professions stuff, etc.
3184 // pussywizard: but only for spells that are really added (inactive -> active OR added to current spec)
3185 bool spellIsNew = true;
3186
3187 // pussywizard: present in m_spells, not removed, already in current spec, already active
3188 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec))
3189 spellIsNew = false;
3190
3191 // pussywizard: update info in m_spells
3192 if (itr->second->State != PLAYERSPELL_NEW && (itr->second->specMask & addSpecMask) != addSpecMask)
3193 itr->second->State = PLAYERSPELL_CHANGED;
3194 itr->second->Active = true;
3195 itr->second->specMask |= addSpecMask;
3196
3197 if (!spellIsNew)
3198 return true;
3199 }
3200 else // pussywizard: not found in m_spells
3201 {
3202 PlayerSpell* newspell = new PlayerSpell;
3203 newspell->Active = true;
3205 newspell->specMask = addSpecMask;
3206
3207 m_spells[spellId] = newspell;
3208 }
3209
3210 // pussywizard: return if spell not in current spec
3211 // pussywizard: return true to fix active for ranks, this condition is true only at loading, so no problems with learning packets
3212 if (!((1 << GetActiveSpec()) & addSpecMask))
3213 return true;
3214
3215 // xinef: do not add spells with effect learn spell
3216 if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3217 {
3218 LOG_INFO("entities.player", "TRYING TO LEARN SPELL WITH EFFECT LEARN 2: {}, PLAYER: {}", spellId, GetGUID().ToString());
3219 m_spells.erase(spellInfo->Id); // mem leak, but should never happen
3220 return false;
3221 //ABORT();
3222 }
3223 // pussywizard: cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
3224 else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
3225 {
3226 if (IsNeedCastPassiveSpellAtLearn(spellInfo))
3227 CastSpell(this, spellId, true);
3228 }
3229 // pussywizard: cast and return, learnt spells will update profession count, etc.
3230 else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP))
3231 {
3232 CastSpell(this, spellId, true);
3233 return false;
3234 }
3235
3236 // xinef: unapply aura stats if dont meet requirements
3237 // xinef: handle only if player is not loaded, loading is handled in loadfromdb
3238 if (!isBeingLoaded())
3239 if (Aura* aura = GetAura(spellId))
3240 {
3241 if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT ||
3242 aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT ||
3243 aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT )
3244 if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState))
3245 aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false);
3246 }
3247
3248 // pussywizard: update free primary prof points
3249 if (uint32 freeProfs = GetFreePrimaryProfessionPoints())
3250 {
3251 if (spellInfo->IsPrimaryProfessionFirstRank())
3252 SetFreePrimaryProfessions(freeProfs - 1);
3253 }
3254
3255 uint16 maxskill = GetMaxSkillValueForLevel();
3256 SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId);
3257 SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
3258 // xinef: set appropriate skill value
3259 if (spellLearnSkill)
3260 {
3261 uint32 skill_value = GetPureSkillValue(spellLearnSkill->skill);
3262 uint32 skill_max_value = GetPureMaxSkillValue(spellLearnSkill->skill);
3263 uint32 new_skill_max_value = spellLearnSkill->maxvalue == 0 ? maxskill : spellLearnSkill->maxvalue;
3264
3265 if (skill_value < spellLearnSkill->value)
3266 skill_value = spellLearnSkill->value;
3267 if (skill_max_value < new_skill_max_value)
3268 skill_max_value = new_skill_max_value;
3269
3270 SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value);
3271 }
3272 else
3273 {
3274 // not ranked skills
3275 for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
3276 {
3277 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine);
3278 if (!pSkill)
3279 continue;
3280
3282 // Added for runeforging, it is confirmed via sniff that this happens when death knights learn the spell, not on character creation.
3283 if ((_spell_idx->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && !HasSkill(pSkill->id)) || ((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->TrivialSkillLineRankHigh == 0))
3284 LearnDefaultSkill(pSkill->id, 0);
3285
3286 if (pSkill->id == SKILL_MOUNTS && !Has310Flyer(false))
3287 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3288 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310)
3289 SetHas310Flyer(true);
3290 }
3291 }
3292
3293 // xinef: update achievement criteria
3294 if (!GetSession()->PlayerLoading())
3295 {
3296 for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
3297 {
3300 }
3302 }
3303
3304 return true;
3305}
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN
Definition DBCEnums.h:361
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL
Definition DBCEnums.h:148
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS
Definition DBCEnums.h:185
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE
Definition DBCEnums.h:218
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1638
std::uint16_t uint16
Definition Define.h:108
#define LOG_INFO(filterType__,...)
Definition Log.h:166
#define SPEC_MASK_ALL
Definition Player.h:177
@ PLAYERSPELL_REMOVED
Definition Player.h:122
@ PLAYERSPELL_UNCHANGED
Definition Player.h:119
@ PLAYERSPELL_CHANGED
Definition Player.h:120
@ PLAYERSPELL_NEW
Definition Player.h:121
@ PLAYERSPELL_TEMPORARY
Definition Player.h:123
@ SPELL_EFFECT_LEARN_SPELL
Definition SharedDefines.h:814
@ SPELL_EFFECT_SKILL_STEP
Definition SharedDefines.h:822
SpellAttr0
Definition SharedDefines.h:381
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:388
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition SharedDefines.h:389
AuraStateType
Definition SharedDefines.h:1288
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition SharedDefines.h:1305
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition SharedDefines.h:1315
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition SharedDefines.h:1293
@ SKILL_RUNEFORGING
Definition SharedDefines.h:3243
@ SKILL_LOCKPICKING
Definition SharedDefines.h:3214
@ SKILL_MOUNTS
Definition SharedDefines.h:3244
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition SpellAuraDefines.h:270
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
#define sSpellMgr
Definition SpellMgr.h:825
std::pair< SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator > SkillLineAbilityMapBounds
Definition SpellMgr.h:584
Definition SpellAuras.h:87
bool IsInWorld() const
Definition Object.h:108
ObjectGuid GetGUID() const
Definition Object.h:114
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2179
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition Player.cpp:3138
void learnSpell(uint32 spellId, bool temporary=false, bool learnFromSkill=false)
Definition Player.cpp:3316
void LearnDefaultSkill(uint32 skillId, uint16 rank)
Definition Player.cpp:11846
bool isBeingLoaded() const override
Definition PlayerStorage.cpp:4920
void SendLearnPacket(uint32 spellId, bool learn)
Definition Player.cpp:3045
uint16 GetMaxSkillValueForLevel() const
Definition Player.cpp:16205
bool IsNeedCastPassiveSpellAtLearn(SpellInfo const *spellInfo) const
Definition Player.cpp:3307
uint16 GetPureSkillValue(uint32 skill) const
Definition Player.cpp:5548
bool HasSkill(uint32 skill) const
Definition Player.cpp:5462
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition Player.cpp:5518
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
Definition Player.cpp:5362
bool Has310Flyer(bool checkAllSpells, uint32 excludeSpellId=0)
Definition Player.cpp:3510
uint8 GetActiveSpec() const
Definition Player.h:1754
void SetHas310Flyer(bool on)
Definition Player.h:1189
void SetFreePrimaryProfessions(uint16 profs)
Definition Player.h:1783
uint32 GetFreePrimaryProfessionPoints() const
Definition Player.h:1782
Definition SpellInfo.h:316
uint32 Stances
Definition SpellInfo.h:333
bool IsPassive() const
Definition SpellInfo.cpp:1098
uint32 Id
Definition SpellInfo.h:320
bool HasAnyAura() const
Definition SpellInfo.cpp:901
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:415
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
bool IsPrimaryProfessionFirstRank() const
Definition SpellInfo.cpp:983
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:876
static bool CheckSpellValid(SpellInfo const *spellInfo, uint32 spellId, bool isTalent)
Definition SpellMgr.cpp:459
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5637
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition Unit.cpp:10633
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1193
bool PlayerLoading() const
Definition WorldSession.h:342
Definition Player.h:127
PlayerSpellState State
Definition Player.h:128
bool Active
Definition Player.h:129
uint8 specMask
Definition Player.h:130
std::string ToString() const
Definition Position.cpp:52
Definition DBCStructure.h:1584
uint32 id
Definition DBCStructure.h:1585
Definition SpellMgr.h:574
uint16 value
Definition SpellMgr.h:577
uint16 step
Definition SpellMgr.h:576
uint16 maxvalue
Definition SpellMgr.h:578
uint16 skill
Definition SpellMgr.h:575

References _addSpell(), ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, PlayerSpell::Active, AURA_EFFECT_HANDLE_REAL, AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, Unit::CastSpell(), SpellMgr::CheckSpellValid(), SpellInfo::Effects, GetActiveSpec(), Unit::GetAura(), GetFreePrimaryProfessionPoints(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetPureMaxSkillValue(), GetPureSkillValue(), GetSession(), Has310Flyer(), SpellInfo::HasAnyAura(), SpellInfo::HasAttribute(), Unit::HasAuraState(), SpellInfo::HasEffect(), HasSkill(), SpellInfo::Id, SkillLineEntry::id, isBeingLoaded(), Object::IsInWorld(), IsNeedCastPassiveSpellAtLearn(), SpellInfo::IsPassive(), SpellInfo::IsPrimaryProfessionFirstRank(), LearnDefaultSkill(), learnSpell(), LOG_INFO, m_activeSpec, m_spells, MAX_SPELL_EFFECTS, SpellLearnSkillNode::maxvalue, WorldSession::PlayerLoading(), PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, SendLearnPacket(), SetFreePrimaryProfessions(), SetHas310Flyer(), SetSkill(), SpellLearnSkillNode::skill, SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN, SKILL_LOCKPICKING, SKILL_MOUNTS, SKILL_RUNEFORGING, SPEC_MASK_ALL, PlayerSpell::specMask, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_ATTR0_PASSIVE, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_SKILL_STEP, sSkillLineStore, sSpellMgr, SpellInfo::Stances, PlayerSpell::State, SpellLearnSkillNode::step, Position::ToString(), UpdateAchievementCriteria(), and SpellLearnSkillNode::value.

Referenced by _addSpell(), _addTalentAurasAndSpells(), addSpell(), AuraEffect::HandleAuraModShapeshift(), and AuraEffect::HandleAuraOverrideSpells().

◆ _AddSpellCooldown()

void Player::_AddSpellCooldown ( uint32  spell_id,
uint16  categoryId,
uint32  itemid,
uint32  end_time,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
11045{
11046 SpellCooldown sc;
11047 sc.end = GameTime::GetGameTimeMS().count() + end_time;
11048 sc.category = categoryId;
11049 sc.itemid = itemid;
11050 sc.maxduration = end_time;
11051 sc.sendToSpectator = false;
11052 sc.needSendToClient = needSendToClient;
11053
11055 {
11056 if (NeedSendSpectatorData() && forceSendToSpectator && (itemid || HasActiveSpell(spellid)))
11057 {
11058 sc.sendToSpectator = true;
11059 ArenaSpectator::SendCommand_Cooldown(FindMap(), GetGUID(), "ACD", spellid, end_time / IN_MILLISECONDS, end_time / IN_MILLISECONDS);
11060 }
11061 }
11062
11063 m_spellCooldowns[spellid] = std::move(sc);
11064}
#define SPECTATOR_COOLDOWN_MAX
Definition ArenaSpectator.h:37
#define SPECTATOR_COOLDOWN_MIN
Definition ArenaSpectator.h:36
constexpr auto IN_MILLISECONDS
Definition Common.h:53
bool NeedSendSpectatorData() const
Definition Player.cpp:15368
bool HasActiveSpell(uint32 spell) const
Definition Player.cpp:3916
SpellCooldowns m_spellCooldowns
Definition Player.h:3004
Map * FindMap() const
Definition Object.h:611
void SendCommand_Cooldown(T *o, ObjectGuid targetGUID, const char *prefix, uint32 id, uint32 dur, uint32 maxdur)
Definition ArenaSpectator.h:89
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:43
Definition Player.h:200
uint32 itemid
Definition Player.h:203
bool sendToSpectator
Definition Player.h:205
bool needSendToClient
Definition Player.h:206
uint32 end
Definition Player.h:201
uint32 maxduration
Definition Player.h:204
uint16 category
Definition Player.h:202

References SpellCooldown::category, SpellCooldown::end, WorldObject::FindMap(), GameTime::GetGameTimeMS(), Object::GetGUID(), HasActiveSpell(), IN_MILLISECONDS, SpellCooldown::itemid, m_spellCooldowns, SpellCooldown::maxduration, NeedSendSpectatorData(), SpellCooldown::needSendToClient, ArenaSpectator::SendCommand_Cooldown(), SpellCooldown::sendToSpectator, SPECTATOR_COOLDOWN_MAX, and SPECTATOR_COOLDOWN_MIN.

Referenced by _LoadSpellCooldowns(), AddSpellAndCategoryCooldowns(), and AddSpellCooldown().

◆ _addTalentAurasAndSpells()

void Player::_addTalentAurasAndSpells ( uint32  spellId)
3029{
3030 // pussywizard: spells learnt from talents are added as TEMPORARY, so not saved to db (only the talent itself is saved)
3031 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
3032 if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3033 {
3034 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3035 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
3036 _addSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true);
3037 }
3038 else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
3039 {
3040 if (IsNeedCastPassiveSpellAtLearn(spellInfo))
3041 CastSpell(this, spellId, true);
3042 }
3043}

References _addSpell(), Unit::CastSpell(), SpellInfo::Effects, SpellInfo::HasAttribute(), SpellInfo::HasEffect(), IsNeedCastPassiveSpellAtLearn(), SpellInfo::IsPassive(), MAX_SPELL_EFFECTS, SPEC_MASK_ALL, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_EFFECT_LEARN_SPELL, sSpellMgr, and SpellInfo::Stances.

Referenced by ActivateSpec(), and addTalent().

◆ _ApplyAllItemMods()

void Player::_ApplyAllItemMods ( )
7577{
7578 LOG_DEBUG("entities.player.items", "_ApplyAllItemMods start.");
7579
7580 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7581 {
7582 if (m_items[i])
7583 {
7584 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7585 continue;
7586
7587 ItemTemplate const* proto = m_items[i]->GetTemplate();
7588 if (!proto)
7589 continue;
7590
7591 uint32 attacktype = Player::GetAttackBySlot(i);
7592 if (attacktype < MAX_ATTACK)
7594
7595 _ApplyItemBonuses(proto, i, true);
7596
7597 if (i == EQUIPMENT_SLOT_RANGED)
7599 }
7600 }
7601
7602 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7603 {
7604 if (m_items[i])
7605 {
7606 ItemTemplate const* proto = m_items[i]->GetTemplate();
7607 if (!proto)
7608 continue;
7609
7610 // item set bonuses not dependent from item broken state
7611 if (proto->ItemSet)
7612 AddItemsSetItem(this, m_items[i]);
7613
7614 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7615 continue;
7616
7617 ApplyItemEquipSpell(m_items[i], true);
7618 ApplyEnchantment(m_items[i], true);
7619 }
7620 }
7621
7622 LOG_DEBUG("entities.player.items", "_ApplyAllItemMods complete.");
7623}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:170
void AddItemsSetItem(Player *player, Item *item)
Definition Item.cpp:32
@ INVENTORY_SLOT_BAG_END
Definition Player.h:707
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:699
WeaponAttackType
Definition Unit.h:209
@ MAX_ATTACK
Definition Unit.h:213
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
void _ApplyAmmoBonuses()
Definition Player.cpp:7643
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change=false)
Definition Player.cpp:7134
void ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur=true, bool ignore_condition=false)
Definition PlayerStorage.cpp:4304
void _ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale=false)
Definition Player.cpp:6625
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply)
Definition Player.cpp:7030
static uint8 GetAttackBySlot(uint8 slot)
Definition PlayerStorage.cpp:542
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.h:931
Definition ItemTemplate.h:619
uint32 ItemSet
Definition ItemTemplate.h:675

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), AddItemsSetItem(), ApplyEnchantment(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, ItemTemplate::ItemSet, LOG_DEBUG, m_items, and MAX_ATTACK.

Referenced by _ApplyAllStatBonuses(), and _LoadInventory().

◆ _ApplyAllLevelScaleItemMods()

void Player::_ApplyAllLevelScaleItemMods ( bool  apply)
7626{
7627 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7628 {
7629 if (m_items[i])
7630 {
7631 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7632 continue;
7633
7634 ItemTemplate const* proto = m_items[i]->GetTemplate();
7635 if (!proto)
7636 continue;
7637
7638 _ApplyItemMods(m_items[i], i, apply);
7639 }
7640 }
7641}
void _ApplyItemMods(Item *item, uint8 slot, bool apply)
Definition Player.cpp:6590

References _ApplyItemMods(), Unit::CanUseAttackType(), GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, and m_items.

Referenced by GiveLevel(), and reset_commandscript::HandleResetLevelCommand().

◆ _ApplyAllStatBonuses()

void Player::_ApplyAllStatBonuses ( )
1009{
1010 SetCanModifyStats(false);
1011
1014
1015 SetCanModifyStats(true);
1016
1018}
void _ApplyAllItemMods()
Definition Player.cpp:7576
bool UpdateAllStats() override
Definition StatSystem.cpp:205
void _ApplyAllAuraStatMods()
Definition Unit.cpp:5544
void SetCanModifyStats(bool modifyStats)
Definition Unit.h:1019

References Unit::_ApplyAllAuraStatMods(), _ApplyAllItemMods(), Unit::SetCanModifyStats(), and UpdateAllStats().

Referenced by InitStatsForLevel().

◆ _ApplyAmmoBonuses()

void Player::_ApplyAmmoBonuses ( )
7644{
7645 // check ammo
7647 if (!ammo_id)
7648 return;
7649
7650 float currentAmmoDPS;
7651
7652 ItemTemplate const* ammo_proto = sObjectMgr->GetItemTemplate(ammo_id);
7653 if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
7654 currentAmmoDPS = 0.0f;
7655 else
7656 currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2;
7657
7658 sScriptMgr->OnPlayerApplyAmmoBonuses(this, ammo_proto, currentAmmoDPS);
7659
7660 if (currentAmmoDPS == GetAmmoDPS())
7661 return;
7662
7663 m_ammoDPS = currentAmmoDPS;
7664
7665 if (CanModifyStats())
7667}
@ ITEM_CLASS_PROJECTILE
Definition ItemTemplate.h:297
#define sObjectMgr
Definition ObjectMgr.h:1650
@ RANGED_ATTACK
Definition Unit.h:212
@ PLAYER_AMMO_ID
Definition UpdateFields.h:369
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
bool CheckAmmoCompatibility(ItemTemplate const *ammo_proto) const
Definition Player.cpp:7669
float GetAmmoDPS() const
Definition Player.h:1344
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
bool CanModifyStats() const
Definition Unit.h:1020
_Damage Damage[MAX_ITEM_PROTO_DAMAGES]
Definition ItemTemplate.h:651
uint32 Class
Definition ItemTemplate.h:621
float DamageMin
Definition ItemTemplate.h:579
float DamageMax
Definition ItemTemplate.h:580

References Unit::CanModifyStats(), CheckAmmoCompatibility(), ItemTemplate::Class, ItemTemplate::Damage, _Damage::DamageMax, _Damage::DamageMin, GetAmmoDPS(), Object::GetUInt32Value(), ITEM_CLASS_PROJECTILE, m_ammoDPS, PLAYER_AMMO_ID, RANGED_ATTACK, sObjectMgr, sScriptMgr, and Unit::UpdateDamagePhysical().

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and SetAmmo().

◆ _ApplyItemBonuses()

void Player::_ApplyItemBonuses ( ItemTemplate const *  proto,
uint8  slot,
bool  apply,
bool  only_level_scale = false 
)
Deprecated:
item mods
6626{
6627 if (slot >= INVENTORY_SLOT_BAG_END || !proto)
6628 return;
6629
6630 ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
6631 if (only_level_scale && !ssd)
6632 return;
6633
6634 // req. check at equip, but allow use for extended range if range limit max level, set proper level
6635 uint32 ssd_level = GetLevel();
6636 uint32 CustomScalingStatValue = 0;
6637
6638 sScriptMgr->OnPlayerCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
6639
6640 uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
6641
6642 if (ssd && ssd_level > ssd->MaxLevel)
6643 ssd_level = ssd->MaxLevel;
6644
6645 ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr;
6646 if (only_level_scale && !ssv)
6647 return;
6648
6649 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
6650 {
6651 uint32 statType = 0;
6652 int32 val = 0;
6653 // If set ScalingStatDistribution need get stats and values from it
6654 if (ssv)
6655 {
6656 if (ssd)
6657 {
6658 if (ssd->StatMod[i] < 0)
6659 continue;
6660
6661 statType = ssd->StatMod[i];
6662 val = (ssv->getssdMultiplier(ScalingStatValue) * ssd->Modifier[i]) / 10000;
6663 }
6664 else
6665 {
6666 if (i >= proto->StatsCount)
6667 continue;
6668
6669 // OnCustomScalingStatValue(Player* player, ItemTemplate const* proto, uint32& statType, int32& val, uint8 itemProtoStatNumber, uint32 ScalingStatValue, ScalingStatValuesEntry const* ssv)
6670 sScriptMgr->OnPlayerCustomScalingStatValue(this, proto, statType, val, i, ScalingStatValue, ssv);
6671 }
6672 }
6673 else
6674 {
6675 if (i >= proto->StatsCount)
6676 continue;
6677
6678 statType = proto->ItemStat[i].ItemStatType;
6679 val = proto->ItemStat[i].ItemStatValue;
6680
6681 sScriptMgr->OnPlayerApplyItemModsBefore(this, slot, apply, i, statType, val);
6682 }
6683
6684 if (val == 0)
6685 continue;
6686
6687 switch (statType)
6688 {
6689 case ITEM_MOD_MANA:
6690 HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(val), apply);
6691 break;
6692 case ITEM_MOD_HEALTH: // modify HP
6693 HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(val), apply);
6694 break;
6695 case ITEM_MOD_AGILITY: // modify agility
6697 ApplyStatBuffMod(STAT_AGILITY, float(val), apply);
6698 break;
6699 case ITEM_MOD_STRENGTH: //modify strength
6701 ApplyStatBuffMod(STAT_STRENGTH, float(val), apply);
6702 break;
6703 case ITEM_MOD_INTELLECT: //modify intellect
6705 ApplyStatBuffMod(STAT_INTELLECT, float(val), apply);
6706 break;
6707 case ITEM_MOD_SPIRIT: //modify spirit
6709 ApplyStatBuffMod(STAT_SPIRIT, float(val), apply);
6710 break;
6711 case ITEM_MOD_STAMINA: //modify stamina
6713 ApplyStatBuffMod(STAT_STAMINA, float(val), apply);
6714 break;
6717 break;
6719 ApplyRatingMod(CR_DODGE, int32(val), apply);
6720 break;
6722 ApplyRatingMod(CR_PARRY, int32(val), apply);
6723 break;
6725 ApplyRatingMod(CR_BLOCK, int32(val), apply);
6726 break;
6728 ApplyRatingMod(CR_HIT_MELEE, int32(val), apply);
6729 break;
6731 ApplyRatingMod(CR_HIT_RANGED, int32(val), apply);
6732 break;
6734 ApplyRatingMod(CR_HIT_SPELL, int32(val), apply);
6735 break;
6737 ApplyRatingMod(CR_CRIT_MELEE, int32(val), apply);
6738 break;
6740 ApplyRatingMod(CR_CRIT_RANGED, int32(val), apply);
6741 break;
6743 ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
6744 break;
6747 break;
6750 break;
6753 break;
6756 break;
6759 break;
6762 break;
6764 ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
6765 break;
6767 ApplyRatingMod(CR_HASTE_RANGED, int32(val), apply);
6768 break;
6770 ApplyRatingMod(CR_HASTE_SPELL, int32(val), apply);
6771 break;
6773 ApplyRatingMod(CR_HIT_MELEE, int32(val), apply);
6774 ApplyRatingMod(CR_HIT_RANGED, int32(val), apply);
6775 ApplyRatingMod(CR_HIT_SPELL, int32(val), apply);
6776 break;
6778 ApplyRatingMod(CR_CRIT_MELEE, int32(val), apply);
6779 ApplyRatingMod(CR_CRIT_RANGED, int32(val), apply);
6780 ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
6781 break;
6786 break;
6792 break;
6794 ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
6795 ApplyRatingMod(CR_HASTE_RANGED, int32(val), apply);
6796 ApplyRatingMod(CR_HASTE_SPELL, int32(val), apply);
6797 break;
6799 ApplyRatingMod(CR_EXPERTISE, int32(val), apply);
6800 break;
6804 break;
6807 break;
6808 // case ITEM_MOD_FERAL_ATTACK_POWER:
6809 // ApplyFeralAPBonus(int32(val), apply);
6810 // break;
6812 ApplyManaRegenBonus(int32(val), apply);
6813 break;
6816 break;
6818 ApplySpellPowerBonus(int32(val), apply);
6819 break;
6821 ApplyHealthRegenBonus(int32(val), apply);
6822 break;
6824 ApplySpellPenetrationBonus(val, apply);
6825 break;
6827 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
6828 break;
6831 ApplySpellHealingBonus(int32(val), apply);
6832 break;
6834 ApplySpellDamageBonus(int32(val), apply);
6835 break;
6836 }
6837 }
6838
6839 // Apply Spell Power from ScalingStatValue if set
6840 if (ssv)
6841 if (int32 spellbonus = ssv->getSpellBonus(ScalingStatValue))
6842 ApplySpellPowerBonus(spellbonus, apply);
6843
6844 // If set ScalingStatValue armor get it or use item armor
6845 uint32 armor = proto->Armor;
6846 if (ssv)
6847 {
6848 if (uint32 ssvarmor = ssv->getArmorMod(ScalingStatValue))
6849 if (proto->ScalingStatValue > 0 || ssvarmor < proto->Armor) //Check to avoid higher values than stat itself (heirloom OR items with correct armor value)
6850 armor = ssvarmor;
6851 }
6852 else if (armor && proto->ArmorDamageModifier)
6853 armor -= uint32(proto->ArmorDamageModifier);
6854
6855 if (armor)
6856 {
6857 UnitModifierType modType = TOTAL_VALUE;
6858 if (proto->Class == ITEM_CLASS_ARMOR)
6859 {
6860 switch (proto->SubClass)
6861 {
6867 modType = BASE_VALUE;
6868 break;
6869 }
6870 }
6871 HandleStatModifier(UNIT_MOD_ARMOR, modType, float(armor), apply);
6872 }
6873
6874 // Add armor bonus from ArmorDamageModifier if > 0
6875 if (proto->ArmorDamageModifier > 0 && sScriptMgr->OnPlayerCanArmorDamageModifier(this))
6876 HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply);
6877
6878 if (proto->Block)
6879 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(proto->Block), apply);
6880
6881 if (proto->HolyRes)
6882 HandleStatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(proto->HolyRes), apply);
6883
6884 if (proto->FireRes)
6885 HandleStatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(proto->FireRes), apply);
6886
6887 if (proto->NatureRes)
6888 HandleStatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(proto->NatureRes), apply);
6889
6890 if (proto->FrostRes)
6891 HandleStatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(proto->FrostRes), apply);
6892
6893 if (proto->ShadowRes)
6894 HandleStatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(proto->ShadowRes), apply);
6895
6896 if (proto->ArcaneRes)
6897 HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply);
6898
6899 uint8 attType = Player::GetAttackBySlot(slot);
6900 if (attType != MAX_ATTACK)
6901 {
6902 _ApplyWeaponDamage(slot, proto, ssv, apply);
6903 }
6904
6905 // Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue)
6907 {
6908 int32 dpsMod = 0;
6909 int32 feral_bonus = 0;
6910 if (ssv)
6911 {
6912 dpsMod = ssv->getDPSMod(ScalingStatValue);
6913 feral_bonus += ssv->getFeralBonus(ScalingStatValue);
6914 }
6915
6916 feral_bonus += proto->getFeralBonus(dpsMod);
6917 sScriptMgr->OnPlayerGetFeralApBonus(this, feral_bonus, dpsMod, proto, ssv);
6918 if (feral_bonus)
6919 ApplyFeralAPBonus(feral_bonus, apply);
6920 }
6921}
DBCStorage< ScalingStatDistributionEntry > sScalingStatDistributionStore(ScalingStatDistributionfmt)
DBCStorage< ScalingStatValuesEntry > sScalingStatValuesStore(ScalingStatValuesfmt)
std::int32_t int32
Definition Define.h:103
@ ITEM_MOD_CRIT_TAKEN_RANGED_RATING
Definition ItemTemplate.h:48
@ ITEM_MOD_HIT_MELEE_RATING
Definition ItemTemplate.h:38
@ ITEM_MOD_HIT_TAKEN_MELEE_RATING
Definition ItemTemplate.h:44
@ ITEM_MOD_STAMINA
Definition ItemTemplate.h:33
@ ITEM_MOD_HIT_SPELL_RATING
Definition ItemTemplate.h:40
@ ITEM_MOD_SPELL_PENETRATION
Definition ItemTemplate.h:69
@ ITEM_MOD_PARRY_RATING
Definition ItemTemplate.h:36
@ ITEM_MOD_DEFENSE_SKILL_RATING
Definition ItemTemplate.h:34
@ ITEM_MOD_HASTE_RANGED_RATING
Definition ItemTemplate.h:51
@ ITEM_MOD_CRIT_TAKEN_RATING
Definition ItemTemplate.h:56
@ ITEM_MOD_EXPERTISE_RATING
Definition ItemTemplate.h:59
@ ITEM_MOD_MANA
Definition ItemTemplate.h:27
@ ITEM_MOD_RANGED_ATTACK_POWER
Definition ItemTemplate.h:61
@ ITEM_MOD_HEALTH
Definition ItemTemplate.h:28
@ ITEM_MOD_CRIT_TAKEN_SPELL_RATING
Definition ItemTemplate.h:49
@ ITEM_MOD_HIT_TAKEN_SPELL_RATING
Definition ItemTemplate.h:46
@ ITEM_MOD_SPIRIT
Definition ItemTemplate.h:32
@ ITEM_MOD_SPELL_POWER
Definition ItemTemplate.h:67
@ ITEM_MOD_HASTE_SPELL_RATING
Definition ItemTemplate.h:52
@ ITEM_MOD_ATTACK_POWER
Definition ItemTemplate.h:60
@ ITEM_MOD_HASTE_RATING
Definition ItemTemplate.h:58
@ ITEM_MOD_HIT_RANGED_RATING
Definition ItemTemplate.h:39
@ ITEM_MOD_CRIT_SPELL_RATING
Definition ItemTemplate.h:43
@ ITEM_MOD_BLOCK_VALUE
Definition ItemTemplate.h:70
@ ITEM_MOD_CRIT_RANGED_RATING
Definition ItemTemplate.h:42
@ ITEM_MOD_CRIT_MELEE_RATING
Definition ItemTemplate.h:41
@ ITEM_MOD_STRENGTH
Definition ItemTemplate.h:30
@ ITEM_MOD_HEALTH_REGEN
Definition ItemTemplate.h:68
@ ITEM_MOD_BLOCK_RATING
Definition ItemTemplate.h:37
@ ITEM_MOD_ARMOR_PENETRATION_RATING
Definition ItemTemplate.h:66
@ ITEM_MOD_SPELL_HEALING_DONE
Definition ItemTemplate.h:63
@ ITEM_MOD_CRIT_TAKEN_MELEE_RATING
Definition ItemTemplate.h:47
@ ITEM_MOD_HIT_TAKEN_RATING
Definition ItemTemplate.h:55
@ ITEM_MOD_HASTE_MELEE_RATING
Definition ItemTemplate.h:50
@ ITEM_MOD_MANA_REGENERATION
Definition ItemTemplate.h:65
@ ITEM_MOD_HIT_RATING
Definition ItemTemplate.h:53
@ ITEM_MOD_INTELLECT
Definition ItemTemplate.h:31
@ ITEM_MOD_RESILIENCE_RATING
Definition ItemTemplate.h:57
@ ITEM_MOD_AGILITY
Definition ItemTemplate.h:29
@ ITEM_MOD_DODGE_RATING
Definition ItemTemplate.h:35
@ ITEM_MOD_CRIT_RATING
Definition ItemTemplate.h:54
@ ITEM_MOD_SPELL_DAMAGE_DONE
Definition ItemTemplate.h:64
@ ITEM_MOD_HIT_TAKEN_RANGED_RATING
Definition ItemTemplate.h:45
@ ITEM_SUBCLASS_ARMOR_MAIL
Definition ItemTemplate.h:393
@ ITEM_SUBCLASS_ARMOR_CLOTH
Definition ItemTemplate.h:391
@ ITEM_SUBCLASS_ARMOR_LEATHER
Definition ItemTemplate.h:392
@ ITEM_SUBCLASS_ARMOR_SHIELD
Definition ItemTemplate.h:396
@ ITEM_SUBCLASS_ARMOR_PLATE
Definition ItemTemplate.h:394
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
#define MAX_ITEM_PROTO_STATS
Definition ItemTemplate.h:616
@ CLASS_DRUID
Definition SharedDefines.h:151
@ STAT_SPIRIT
Definition SharedDefines.h:262
@ STAT_INTELLECT
Definition SharedDefines.h:261
@ STAT_AGILITY
Definition SharedDefines.h:259
@ STAT_STRENGTH
Definition SharedDefines.h:258
@ STAT_STAMINA
Definition SharedDefines.h:260
@ CLASS_CONTEXT_STATS
Definition UnitDefines.h:230
@ UNIT_MOD_STAT_INTELLECT
Definition Unit.h:147
@ UNIT_MOD_STAT_SPIRIT
Definition Unit.h:148
@ UNIT_MOD_ARMOR
Definition Unit.h:157
@ UNIT_MOD_RESISTANCE_SHADOW
Definition Unit.h:162
@ UNIT_MOD_RESISTANCE_FROST
Definition Unit.h:161
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:164
@ UNIT_MOD_RESISTANCE_HOLY
Definition Unit.h:158
@ UNIT_MOD_RESISTANCE_ARCANE
Definition Unit.h:163
@ UNIT_MOD_HEALTH
Definition Unit.h:149
@ UNIT_MOD_RESISTANCE_FIRE
Definition Unit.h:159
@ UNIT_MOD_STAT_STRENGTH
Definition Unit.h:144
@ UNIT_MOD_RESISTANCE_NATURE
Definition Unit.h:160
@ UNIT_MOD_STAT_AGILITY
Definition Unit.h:145
@ UNIT_MOD_MANA
Definition Unit.h:150
@ UNIT_MOD_STAT_STAMINA
Definition Unit.h:146
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:165
@ SHIELD_BLOCK_VALUE
Definition Unit.h:184
UnitModifierType
Definition Unit.h:126
@ BASE_VALUE
Definition Unit.h:127
@ TOTAL_VALUE
Definition Unit.h:129
@ CR_EXPERTISE
Definition Unit.h:241
@ CR_HIT_TAKEN_MELEE
Definition Unit.h:229
@ CR_HASTE_RANGED
Definition Unit.h:236
@ CR_HIT_MELEE
Definition Unit.h:223
@ CR_CRIT_TAKEN_RANGED
Definition Unit.h:233
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:234
@ CR_ARMOR_PENETRATION
Definition Unit.h:242
@ CR_CRIT_MELEE
Definition Unit.h:226
@ CR_CRIT_RANGED
Definition Unit.h:227
@ CR_HIT_TAKEN_SPELL
Definition Unit.h:231
@ CR_PARRY
Definition Unit.h:221
@ CR_DODGE
Definition Unit.h:220
@ CR_DEFENSE_SKILL
Definition Unit.h:219
@ CR_HASTE_MELEE
Definition Unit.h:235
@ CR_BLOCK
Definition Unit.h:222
@ CR_HASTE_SPELL
Definition Unit.h:237
@ CR_HIT_SPELL
Definition Unit.h:225
@ CR_HIT_TAKEN_RANGED
Definition Unit.h:230
@ CR_CRIT_SPELL
Definition Unit.h:228
@ CR_HIT_RANGED
Definition Unit.h:224
@ CR_CRIT_TAKEN_MELEE
Definition Unit.h:232
void ApplySpellDamageBonus(int32 amount, bool apply)
Definition StatSystem.cpp:177
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5292
void ApplySpellPenetrationBonus(int32 amount, bool apply)
Definition StatSystem.cpp:236
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition Player.cpp:6923
void ApplyManaRegenBonus(int32 amount, bool apply)
Definition StatSystem.cpp:932
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1295
void ApplySpellPowerBonus(int32 amount, bool apply)
Definition StatSystem.cpp:167
void ApplyFeralAPBonus(int32 amount, bool apply)
Definition StatSystem.cpp:341
void ApplyHealthRegenBonus(int32 amount, bool apply)
Definition StatSystem.cpp:938
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition Player.cpp:5051
void ApplySpellHealingBonus(int32 amount, bool apply)
Definition StatSystem.cpp:186
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition Unit.h:1022
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition Unit.cpp:15295
uint8 GetLevel() const
Definition Unit.h:1026
Definition DBCStructure.h:1474
uint32 MaxLevel
Definition DBCStructure.h:1478
uint32 Modifier[10]
Definition DBCStructure.h:1477
int32 StatMod[10]
Definition DBCStructure.h:1476
Definition DBCStructure.h:1482
uint32 getArmorMod(uint32 mask) const
Definition DBCStructure.h:1507
uint32 getDPSMod(uint32 mask) const
Definition DBCStructure.h:1525
uint32 getFeralBonus(uint32 mask) const
Definition DBCStructure.h:1555
uint32 getssdMultiplier(uint32 mask) const
Definition DBCStructure.h:1493
uint32 getSpellBonus(uint32 mask) const
Definition DBCStructure.h:1549

References _ApplyWeaponDamage(), ApplyFeralAPBonus(), ApplyHealthRegenBonus(), ApplyManaRegenBonus(), ApplyRatingMod(), ApplySpellDamageBonus(), ApplySpellHealingBonus(), ApplySpellPenetrationBonus(), ApplySpellPowerBonus(), Unit::ApplyStatBuffMod(), ItemTemplate::ArcaneRes, ItemTemplate::Armor, ItemTemplate::ArmorDamageModifier, BASE_VALUE, ItemTemplate::Block, ItemTemplate::Class, CLASS_CONTEXT_STATS, CLASS_DRUID, CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_HIT_TAKEN_MELEE, CR_HIT_TAKEN_RANGED, CR_HIT_TAKEN_SPELL, CR_PARRY, ItemTemplate::FireRes, FLAT_MOD, ItemTemplate::FrostRes, ScalingStatValuesEntry::getArmorMod(), GetAttackBySlot(), ScalingStatValuesEntry::getDPSMod(), ItemTemplate::getFeralBonus(), ScalingStatValuesEntry::getFeralBonus(), Unit::GetLevel(), ScalingStatValuesEntry::getSpellBonus(), ScalingStatValuesEntry::getssdMultiplier(), HandleBaseModValue(), Unit::HandleStatModifier(), ItemTemplate::HolyRes, INVENTORY_SLOT_BAG_END, IsClass(), ITEM_CLASS_ARMOR, ITEM_MOD_AGILITY, ITEM_MOD_ARMOR_PENETRATION_RATING, ITEM_MOD_ATTACK_POWER, ITEM_MOD_BLOCK_RATING, ITEM_MOD_BLOCK_VALUE, ITEM_MOD_CRIT_MELEE_RATING, ITEM_MOD_CRIT_RANGED_RATING, ITEM_MOD_CRIT_RATING, ITEM_MOD_CRIT_SPELL_RATING, ITEM_MOD_CRIT_TAKEN_MELEE_RATING, ITEM_MOD_CRIT_TAKEN_RANGED_RATING, ITEM_MOD_CRIT_TAKEN_RATING, ITEM_MOD_CRIT_TAKEN_SPELL_RATING, ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_EXPERTISE_RATING, ITEM_MOD_HASTE_MELEE_RATING, ITEM_MOD_HASTE_RANGED_RATING, ITEM_MOD_HASTE_RATING, ITEM_MOD_HASTE_SPELL_RATING, ITEM_MOD_HEALTH, ITEM_MOD_HEALTH_REGEN, ITEM_MOD_HIT_MELEE_RATING, ITEM_MOD_HIT_RANGED_RATING, ITEM_MOD_HIT_RATING, ITEM_MOD_HIT_SPELL_RATING, ITEM_MOD_HIT_TAKEN_MELEE_RATING, ITEM_MOD_HIT_TAKEN_RANGED_RATING, ITEM_MOD_HIT_TAKEN_RATING, ITEM_MOD_HIT_TAKEN_SPELL_RATING, ITEM_MOD_INTELLECT, ITEM_MOD_MANA, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_PARRY_RATING, ITEM_MOD_RANGED_ATTACK_POWER, ITEM_MOD_RESILIENCE_RATING, ITEM_MOD_SPELL_DAMAGE_DONE, ITEM_MOD_SPELL_HEALING_DONE, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_SPELL_POWER, ITEM_MOD_SPIRIT, ITEM_MOD_STAMINA, ITEM_MOD_STRENGTH, ITEM_SUBCLASS_ARMOR_CLOTH, ITEM_SUBCLASS_ARMOR_LEATHER, ITEM_SUBCLASS_ARMOR_MAIL, ITEM_SUBCLASS_ARMOR_PLATE, ITEM_SUBCLASS_ARMOR_SHIELD, ItemTemplate::ItemStat, _ItemStat::ItemStatType, _ItemStat::ItemStatValue, MAX_ATTACK, MAX_ITEM_PROTO_STATS, ScalingStatDistributionEntry::MaxLevel, ScalingStatDistributionEntry::Modifier, ItemTemplate::NatureRes, ItemTemplate::ScalingStatDistribution, ItemTemplate::ScalingStatValue, ItemTemplate::ShadowRes, SHIELD_BLOCK_VALUE, sScalingStatDistributionStore, sScalingStatValuesStore, sScriptMgr, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, ScalingStatDistributionEntry::StatMod, ItemTemplate::StatsCount, ItemTemplate::SubClass, TOTAL_VALUE, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), and _RemoveAllItemMods().

◆ _ApplyItemMods()

void Player::_ApplyItemMods ( Item item,
uint8  slot,
bool  apply 
)
6591{
6592 if (slot >= INVENTORY_SLOT_BAG_END || !item)
6593 return;
6594
6595 ItemTemplate const* proto = item->GetTemplate();
6596
6597 if (!proto)
6598 return;
6599
6600 // not apply/remove mods for broken item
6601 if (item->IsBroken())
6602 return;
6603
6604 LOG_DEBUG("entities.player", "applying mods for item {} ", item->GetGUID().ToString());
6605
6606 uint8 attacktype = Player::GetAttackBySlot(slot);
6607
6608 if (item->HasSocket()) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items
6609 CorrectMetaGemEnchants(slot, apply);
6610
6611 if (attacktype < MAX_ATTACK)
6612 _ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), apply);
6613
6614 _ApplyItemBonuses(proto, slot, apply);
6615
6616 if (slot == EQUIPMENT_SLOT_RANGED)
6618
6619 ApplyItemEquipSpell(item, apply);
6620 ApplyEnchantment(item, apply);
6621
6622 LOG_DEBUG("entities.player.items", "_ApplyItemMods complete.");
6623}
bool HasSocket() const
Definition Item.cpp:1007
bool IsBroken() const
Definition Item.h:257
std::string ToString() const
Definition ObjectGuid.cpp:47
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
void CorrectMetaGemEnchants(uint8 slot, bool apply)
Definition Player.cpp:11187

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), ApplyEnchantment(), ApplyItemEquipSpell(), CorrectMetaGemEnchants(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Object::GetGUID(), Item::GetTemplate(), Item::HasSocket(), INVENTORY_SLOT_BAG_END, Item::IsBroken(), LOG_DEBUG, MAX_ATTACK, and ObjectGuid::ToString().

Referenced by _ApplyAllLevelScaleItemMods(), DestroyItem(), DurabilityPointsLoss(), DurabilityRepair(), EquipItem(), and RemoveItem().

◆ _ApplyWeaponDamage()

void Player::_ApplyWeaponDamage ( uint8  slot,
ItemTemplate const *  proto,
ScalingStatValuesEntry const *  ssv,
bool  apply 
)
6924{
6925 uint32 CustomScalingStatValue = 0;
6926
6927 sScriptMgr->OnPlayerCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
6928
6929 uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
6930
6931 // following part fix disarm issue
6932 // that doesn't apply the scaling after disarmed
6933 if (!ssv)
6934 {
6935 ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
6936
6937 // req. check at equip, but allow use for extended range if range limit max level, set proper level
6938 uint32 ssd_level = GetLevel();
6939
6940 if (ssd && ssd_level > ssd->MaxLevel)
6941 ssd_level = ssd->MaxLevel;
6942
6943 ssv = ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr;
6944 }
6945
6946 uint8 attType = Player::GetAttackBySlot(slot);
6947 if (!IsInFeralForm() && apply && !CanUseAttackType(attType))
6948 {
6949 return;
6950 }
6951
6952 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6953 {
6954 float minDamage = proto->Damage[i].DamageMin;
6955 float maxDamage = proto->Damage[i].DamageMax;
6956
6957 // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
6958 if (ssv && i == 0) // scaling stats only for first damage
6959 {
6960 int32 extraDPS = ssv->getDPSMod(ScalingStatValue);
6961 if (extraDPS)
6962 {
6963 float average = extraDPS * proto->Delay / 1000.0f;
6964 float mod = ssv->IsTwoHand(proto->ScalingStatValue) ? 0.2f : 0.3f;
6965
6966 minDamage = (1.0f - mod) * average;
6967 maxDamage = (1.0f + mod) * average;
6968 }
6969 }
6970
6971 if (apply)
6972 {
6973 sScriptMgr->OnPlayerApplyWeaponDamage(this, slot, proto, minDamage, maxDamage, i);
6974
6975 if (minDamage > 0.f)
6976 {
6977 SetBaseWeaponDamage(WeaponAttackType(attType), MINDAMAGE, minDamage, i);
6978 }
6979
6980 if (maxDamage > 0.f)
6981 {
6982 SetBaseWeaponDamage(WeaponAttackType(attType), MAXDAMAGE, maxDamage, i);
6983 }
6984 }
6985 }
6986
6987 if (!apply)
6988 {
6989 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6990 {
6993 }
6994
6995 if (attType == BASE_ATTACK)
6996 {
6999 }
7000 }
7001
7002 if (proto->Delay && !IsInFeralForm())
7003 {
7004 if (slot == EQUIPMENT_SLOT_RANGED)
7005 SetAttackTime(RANGED_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
7006 else if (slot == EQUIPMENT_SLOT_MAINHAND)
7007 SetAttackTime(BASE_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
7008 else if (slot == EQUIPMENT_SLOT_OFFHAND)
7009 SetAttackTime(OFF_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
7010 }
7011
7012 // No need to modify any physical damage for ferals as it is calculated from stats only
7013 if (IsInFeralForm())
7014 return;
7015
7016 if (CanModifyStats() && (GetWeaponDamageRange(WeaponAttackType(attType), MAXDAMAGE) || proto->Delay))
7018}
#define MAX_ITEM_PROTO_DAMAGES
Definition ItemTemplate.h:613
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:697
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:698
@ MINDAMAGE
Definition Unit.h:136
@ MAXDAMAGE
Definition Unit.h:137
#define BASE_ATTACK_TIME
Definition Unit.h:42
@ OFF_ATTACK
Definition Unit.h:211
@ BASE_ATTACK
Definition Unit.h:210
#define BASE_MAXDAMAGE
Definition Unit.h:41
#define BASE_MINDAMAGE
Definition Unit.h:40
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
Definition Unit.cpp:15544
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
Definition Unit.h:1139
bool IsInFeralForm() const
Definition Unit.h:1873
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition Unit.h:865

References BASE_ATTACK, BASE_ATTACK_TIME, BASE_MAXDAMAGE, BASE_MINDAMAGE, Unit::CanModifyStats(), Unit::CanUseAttackType(), ItemTemplate::Damage, _Damage::DamageMax, _Damage::DamageMin, ItemTemplate::Delay, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), ScalingStatValuesEntry::getDPSMod(), Unit::GetLevel(), Unit::GetWeaponDamageRange(), Unit::IsInFeralForm(), ScalingStatValuesEntry::IsTwoHand(), MAX_ITEM_PROTO_DAMAGES, MAXDAMAGE, ScalingStatDistributionEntry::MaxLevel, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, ItemTemplate::ScalingStatDistribution, ItemTemplate::ScalingStatValue, Unit::SetAttackTime(), Unit::SetBaseWeaponDamage(), sScalingStatDistributionStore, sScalingStatValuesStore, sScriptMgr, and Unit::UpdateDamagePhysical().

Referenced by _ApplyItemBonuses(), AuraEffect::HandleAuraModDisarm(), and AuraEffect::HandleAuraModShapeshift().

◆ _ApplyWeaponDependentAuraCritMod()

void Player::_ApplyWeaponDependentAuraCritMod ( Item item,
WeaponAttackType  attackType,
AuraEffect const *  aura,
bool  apply 
)
7046{
7047 // don't apply mod if item is broken or cannot be used
7048 if (item->IsBroken() || !CanUseAttackType(attackType))
7049 return;
7050
7051 // generic not weapon specific case processes in aura code
7052 if (aura->GetSpellInfo()->EquippedItemClass == -1)
7053 return;
7054
7055 if (!sScriptMgr->OnPlayerCanApplyWeaponDependentAuraDamageMod(this, item, attackType, aura, apply))
7056 return;
7057
7059 switch (attackType)
7060 {
7061 case BASE_ATTACK:
7062 mod = CRIT_PERCENTAGE;
7063 break;
7064 case OFF_ATTACK:
7066 break;
7067 case RANGED_ATTACK:
7069 break;
7070 default:
7071 return;
7072 }
7073
7074 if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
7075 HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
7076}
BaseModGroup
Definition Unit.h:180
@ OFFHAND_CRIT_PERCENTAGE
Definition Unit.h:183
@ CRIT_PERCENTAGE
Definition Unit.h:181
@ RANGED_CRIT_PERCENTAGE
Definition Unit.h:182
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition Item.cpp:884

References BASE_ATTACK, BASEMOD_END, Unit::CanUseAttackType(), CRIT_PERCENTAGE, SpellInfo::EquippedItemClass, FLAT_MOD, AuraEffect::GetAmount(), AuraEffect::GetSpellInfo(), HandleBaseModValue(), Item::IsBroken(), Item::IsFitToSpellRequirements(), OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, and sScriptMgr.

Referenced by _ApplyWeaponDependentAuraMods(), and AuraEffect::HandleAuraModWeaponCritPercent().

◆ _ApplyWeaponDependentAuraDamageMod()

void Player::_ApplyWeaponDependentAuraDamageMod ( Item item,
WeaponAttackType  attackType,
AuraEffect const *  aura,
bool  apply 
)
7079{
7080 // don't apply mod if item is broken or cannot be used
7081 if (item->IsBroken() || !CanUseAttackType(attackType))
7082 return;
7083
7084 // ignore spell mods for not wands
7085 if ((aura->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) == 0 && (getClassMask() & CLASSMASK_WAND_USERS) == 0)
7086 return;
7087
7088 // generic not weapon specific case processes in aura code
7089 if (aura->GetSpellInfo()->EquippedItemClass == -1)
7090 return;
7091
7092 UnitMods unitMod = UNIT_MOD_END;
7093 switch (attackType)
7094 {
7095 case BASE_ATTACK:
7096 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
7097 break;
7098 case OFF_ATTACK:
7099 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
7100 break;
7101 case RANGED_ATTACK:
7102 unitMod = UNIT_MOD_DAMAGE_RANGED;
7103 break;
7104 default:
7105 return;
7106 }
7107
7108 UnitModifierType unitModType = TOTAL_VALUE;
7109 switch (aura->GetAuraType())
7110 {
7112 unitModType = TOTAL_VALUE;
7113 break;
7115 unitModType = TOTAL_PCT;
7116 break;
7117 default:
7118 return;
7119 }
7120
7121 if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
7122 {
7123 HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
7124 if (unitModType == TOTAL_VALUE)
7125 {
7126 if (aura->GetAmount() > 0)
7127 ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
7128 else
7129 ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, aura->GetAmount(), apply);
7130 }
7131 }
7132}
#define CLASSMASK_WAND_USERS
Definition SharedDefines.h:174
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:297
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
UnitMods
Definition Unit.h:143
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:167
@ UNIT_MOD_END
Definition Unit.h:169
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:168
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:166
@ TOTAL_PCT
Definition Unit.h:130
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
Definition UpdateFields.h:360
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
Definition UpdateFields.h:361
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:795
uint32 getClassMask() const
Definition Unit.h:795

References Object::ApplyModUInt32Value(), BASE_ATTACK, Unit::CanUseAttackType(), CLASSMASK_WAND_USERS, SpellInfo::EquippedItemClass, AuraEffect::GetAmount(), AuraEffect::GetAuraType(), Unit::getClassMask(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), Unit::HandleStatModifier(), Item::IsBroken(), Item::IsFitToSpellRequirements(), OFF_ATTACK, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, RANGED_ATTACK, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_SCHOOL_MASK_NORMAL, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, and UNIT_MOD_END.

Referenced by _ApplyWeaponDependentAuraMods(), AuraEffect::HandleModDamageDone(), and AuraEffect::HandleModDamagePercentDone().

◆ _ApplyWeaponDependentAuraMods()

void Player::_ApplyWeaponDependentAuraMods ( Item item,
WeaponAttackType  attackType,
bool  apply 
)
7031{
7033 for (AuraEffectList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr)
7034 _ApplyWeaponDependentAuraCritMod(item, attackType, *itr, apply);
7035
7037 for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
7038 _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
7039
7041 for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
7042 _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
7043}
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition SpellAuraDefines.h:115
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:7078
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:7045
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1351
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:636

References _ApplyWeaponDependentAuraCritMod(), _ApplyWeaponDependentAuraDamageMod(), Unit::GetAuraEffectsByType(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and AuraEffect::HandleAuraModDisarm().

◆ _LoadActions()

void Player::_LoadActions ( PreparedQueryResult  result)
protected
5681{
5682 m_actionButtons.clear();
5683
5684 if (result)
5685 {
5686 do
5687 {
5688 Field* fields = result->Fetch();
5689 uint8 button = fields[0].Get<uint8>();
5690 uint32 action = fields[1].Get<uint32>();
5691 uint8 type = fields[2].Get<uint8>();
5692
5693 if (ActionButton* ab = addActionButton(button, action, type))
5694 ab->uState = ACTIONBUTTON_UNCHANGED;
5695 else
5696 {
5697
5698 LOG_ERROR("entities.player", "ActionButton loading problem, will be deleted from db. player: {}, guid: {}, button: {}, action: {}, type: {}", GetName(), GetGUID().GetCounter(), button, action, type);
5699
5700 // Will deleted in DB at next save (it can create data until save but marked as deleted)
5701 m_actionButtons[button].uState = ACTIONBUTTON_DELETED;
5702 }
5703 } while (result->NextRow());
5704 }
5705}
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
@ ACTIONBUTTON_UNCHANGED
Definition Player.h:222
@ ACTIONBUTTON_DELETED
Definition Player.h:225
Class used to access individual fields of database query result.
Definition Field.h:98
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
ActionButton * addActionButton(uint8 button, uint32 action, uint8 type)
Definition Player.cpp:5655
ActionButtonList m_actionButtons
Definition Player.h:2838
std::string const & GetName() const
Definition Object.h:514
Definition Player.h:259

References ACTIONBUTTON_DELETED, ACTIONBUTTON_UNCHANGED, addActionButton(), Field::Get(), Object::GetGUID(), WorldObject::GetName(), LOG_ERROR, and m_actionButtons.

Referenced by WorldSession::HandleLoadActionsSwitchSpec(), LoadActions(), and LoadFromDB().

◆ _LoadArenaTeamInfo()

void Player::_LoadArenaTeamInfo ( )
protected
4804{
4806
4807 for (auto const& itr : ArenaTeam::ArenaSlotByType)
4808 if (uint32 arenaTeamId = sCharacterCache->GetCharacterArenaTeamIdByGuid(GetGUID(), itr.second))
4809 {
4810 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
4811 if (!arenaTeam)
4812 {
4813 LOG_ERROR("bg.arena", "Player::_LoadArenaTeamInfo: No arena team was found.");
4814 continue;
4815 }
4816 ArenaTeamMember const* member = arenaTeam->GetMember(GetGUID());
4817 if (!member)
4818 {
4819 LOG_ERROR("bg.arena", "Player::_LoadArenaTeamInfo: No members in the arena team ({}) was found.", arenaTeamId);
4820 continue;
4821 }
4822 uint8 slot = itr.second;
4823
4824 SetArenaTeamInfoField(slot, ARENA_TEAM_ID, arenaTeamId);
4825 SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, arenaTeam->GetType());
4826 SetArenaTeamInfoField(slot, ARENA_TEAM_MEMBER, (arenaTeam->GetCaptain() == GetGUID()) ? 0 : 1);
4831 }
4832}
#define sArenaTeamMgr
Definition ArenaTeamMgr.h:69
#define MAX_ARENA_SLOT
Definition ArenaTeam.h:134
@ ARENA_TEAM_GAMES_WEEK
Definition ArenaTeam.h:77
@ ARENA_TEAM_TYPE
Definition ArenaTeam.h:75
@ ARENA_TEAM_ID
Definition ArenaTeam.h:74
@ ARENA_TEAM_END
Definition ArenaTeam.h:81
@ ARENA_TEAM_PERSONAL_RATING
Definition ArenaTeam.h:80
@ ARENA_TEAM_MEMBER
Definition ArenaTeam.h:76
@ ARENA_TEAM_WINS_SEASON
Definition ArenaTeam.h:79
@ ARENA_TEAM_GAMES_SEASON
Definition ArenaTeam.h:78
#define sCharacterCache
Definition CharacterCache.h:83
@ PLAYER_FIELD_ARENA_TEAM_INFO_1_1
Definition UpdateFields.h:381
Definition ArenaTeam.h:137
ObjectGuid GetCaptain() const
Definition ArenaTeam.h:153
ArenaTeamMember * GetMember(ObjectGuid guid)
Definition ArenaTeam.cpp:1015
uint32 GetType() const
Definition ArenaTeam.h:149
uint32 * m_uint32Values
Definition Object.h:260
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
Definition Player.cpp:16163
Definition ArenaTeam.h:108
uint16 PersonalRating
Definition ArenaTeam.h:116
uint16 SeasonWins
Definition ArenaTeam.h:115
uint16 WeekGames
Definition ArenaTeam.h:112
uint16 SeasonGames
Definition ArenaTeam.h:114

References ARENA_TEAM_END, ARENA_TEAM_GAMES_SEASON, ARENA_TEAM_GAMES_WEEK, ARENA_TEAM_ID, ARENA_TEAM_MEMBER, ARENA_TEAM_PERSONAL_RATING, ARENA_TEAM_TYPE, ARENA_TEAM_WINS_SEASON, ArenaTeam::ArenaSlotByType, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMember(), ArenaTeam::GetType(), LOG_ERROR, Object::m_uint32Values, MAX_ARENA_SLOT, ArenaTeamMember::PersonalRating, PLAYER_FIELD_ARENA_TEAM_INFO_1_1, sArenaTeamMgr, sCharacterCache, ArenaTeamMember::SeasonGames, ArenaTeamMember::SeasonWins, SetArenaTeamInfoField(), and ArenaTeamMember::WeekGames.

Referenced by LoadFromDB().

◆ _LoadAuras()

void Player::_LoadAuras ( PreparedQueryResult  result,
uint32  timediff 
)
protected
5708{
5709 LOG_DEBUG("entities.player.loading", "Loading auras for player {}", GetGUID().ToString());
5710
5711 /* 0 1 2 3 4 5 6 7 8 9 10 11
5712 QueryResult* result = CharacterDatabase.Query("SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2,
5713 12 13 14
5714 maxDuration, remainTime, remainCharges FROM character_aura WHERE guid = '{}'", GetGUID().GetCounter());
5715 */
5716
5717 if (result)
5718 {
5719 do
5720 {
5721 Field* fields = result->Fetch();
5722 int32 damage[3];
5723 int32 baseDamage[3];
5724 ObjectGuid caster_guid = ObjectGuid(fields[0].Get<uint64>());
5725 ObjectGuid itemGuid = ObjectGuid(fields[1].Get<uint64>());
5726 uint32 spellid = fields[2].Get<uint32>();
5727 uint8 effmask = fields[3].Get<uint8>();
5728 uint8 recalculatemask = fields[4].Get<uint8>();
5729 uint8 stackcount = fields[5].Get<uint8>();
5730 damage[0] = fields[6].Get<int32>();
5731 damage[1] = fields[7].Get<int32>();
5732 damage[2] = fields[8].Get<int32>();
5733 baseDamage[0] = fields[9].Get<int32>();
5734 baseDamage[1] = fields[10].Get<int32>();
5735 baseDamage[2] = fields[11].Get<int32>();
5736 int32 maxduration = fields[12].Get<int32>();
5737 int32 remaintime = fields[13].Get<int32>();
5738 uint8 remaincharges = fields[14].Get<uint8>();
5739
5740 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
5741 if (!spellInfo)
5742 {
5743 LOG_ERROR("entities.player", "Unknown aura (spellid {}), ignore.", spellid);
5744 continue;
5745 }
5746
5747 // Xinef: leave this
5748 if (spellInfo->HasAura(SPELL_AURA_MOUNTED))
5749 {
5750 SetMountBlockId(spellInfo->Id);
5751 continue;
5752 }
5753
5754 // negative effects should continue counting down after logout
5755 if (remaintime != -1 && ((!spellInfo->IsPositive() && spellInfo->Id != 15007) || spellInfo->HasAttribute(SPELL_ATTR4_AURA_EXPIRES_OFFLINE))) // Xinef: resurrection sickness should not tick when logged off
5756 {
5757 if (remaintime / IN_MILLISECONDS <= int32(timediff))
5758 continue;
5759
5760 remaintime -= timediff * IN_MILLISECONDS;
5761 }
5762
5763 // prevent wrong values of remaincharges
5764 if (spellInfo->ProcCharges)
5765 {
5766 // we have no control over the order of applying auras and modifiers allow auras
5767 // to have more charges than value in SpellInfo
5768 if (remaincharges <= 0/* || remaincharges > spellproto->procCharges*/)
5769 remaincharges = spellInfo->ProcCharges;
5770 }
5771 else
5772 remaincharges = 0;
5773
5774 if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, nullptr, &baseDamage[0], nullptr, caster_guid, itemGuid))
5775 {
5776 if (!aura->CanBeSaved())
5777 {
5778 aura->Remove();
5779 continue;
5780 }
5781
5782 aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
5783 aura->ApplyForTargets();
5784 LOG_DEBUG("entities.player", "Added aura spellid {}, effectmask {}", spellInfo->Id, effmask);
5785 }
5786 } while (result->NextRow());
5787 }
5788}
@ SPELL_ATTR4_AURA_EXPIRES_OFFLINE
Definition SharedDefines.h:532
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition SpellAuras.cpp:352
Definition ObjectGuid.h:118
void SetMountBlockId(uint32 mount)
Definition Player.h:2621

References Field::Get(), Object::GetGUID(), IN_MILLISECONDS, LOG_DEBUG, LOG_ERROR, SetMountBlockId(), SPELL_ATTR4_AURA_EXPIRES_OFFLINE, SPELL_AURA_MOUNTED, sSpellMgr, Position::ToString(), and Aura::TryCreate().

Referenced by LoadFromDB().

◆ _LoadBrewOfTheMonth()

void Player::_LoadBrewOfTheMonth ( PreparedQueryResult  result)
protected
15750{
15751 uint32 lastEventId = 0;
15752 if (result)
15753 {
15754 Field* fields = result->Fetch();
15755 lastEventId = fields[0].Get<uint32>();
15756 }
15757
15758 uint16 month = static_cast<uint16>(Acore::Time::GetMonth());
15759 uint16 eventId = month;
15760 if (eventId < 9)
15761 eventId += 3;
15762 else
15763 eventId -= 9;
15764
15765 // Brew of the Month October (first in list)
15766 eventId += 34;
15767
15768 if (lastEventId != eventId && IsEventActive(eventId) && HasAchieved(2796 /* Brew of the Month*/))
15769 {
15770 // Send Mail
15771 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15772 MailSender sender(MAIL_CREATURE, 27487 /*NPC_BREW_OF_THE_MONTH_CLUB*/);
15773 MailDraft draft(uint16(212 + month)); // 212 is starting template id
15774 draft.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), sender);
15775
15776 // Update Event Id
15778 stmt->SetData(0, GetGUID().GetCounter());
15779 stmt->SetData(1, uint32(eventId));
15780 trans->Append(stmt);
15781
15782 CharacterDatabase.CommitTransaction(trans);
15783 }
15784}
@ CHAR_REP_BREW_OF_THE_MONTH
Definition CharacterDatabase.h:103
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition DatabaseEnvFwd.h:69
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
bool IsEventActive(uint16 eventId)
Definition GameEventMgr.cpp:1965
@ MAIL_CREATURE
Definition Mail.h:39
Definition Mail.h:119
Definition Mail.h:105
Definition Mail.h:83
bool HasAchieved(uint32 achievementId) const
Definition Player.cpp:13887
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
AC_COMMON_API uint32 GetMonth(Seconds time=0s)
Definition Timer.cpp:424

References CHAR_REP_BREW_OF_THE_MONTH, CharacterDatabase, Field::Get(), Object::GetGUID(), Acore::Time::GetMonth(), HasAchieved(), IsEventActive(), MAIL_CREATURE, MailDraft::SendMailTo(), and PreparedStatementBase::SetData().

Referenced by LoadFromDB().

◆ _LoadCharacterSettings()

void Player::_LoadCharacterSettings ( PreparedQueryResult  result)
protected
27{
28 m_charSettingsMap.clear();
29
30 if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
31 return;
32
33 if (!result)
34 return;
35
36 do
37 {
38 Field* fields = result->Fetch();
39 std::string source = fields[0].Get<std::string>();
40 std::string data = fields[1].Get<std::string>();
41
42 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
43
44 PlayerSettingVector settings;
45 settings.reserve(tokens.size()); // reserve capacity but don't resize
46
47 for (auto const& token : tokens)
48 {
49 if (token.empty())
50 continue;
51
52 // Try to parse the value safely
53 if (auto parsed = Acore::StringTo<uint32>(token))
54 settings.emplace_back(*parsed);
55 }
56
57 m_charSettingsMap.emplace(std::move(source), std::move(settings));
58
59 } while (result->NextRow());
60}
std::vector< PlayerSetting > PlayerSettingVector
Definition PlayerSettings.h:51
@ CONFIG_PLAYER_SETTINGS_ENABLED
Definition WorldConfig.h:128
PlayerSettingMap m_charSettingsMap
Definition Player.h:3028
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Tokenize.cpp:20

References CONFIG_PLAYER_SETTINGS_ENABLED, Field::Get(), m_charSettingsMap, sWorld, and Acore::Tokenize().

Referenced by LoadFromDB().

◆ _LoadDailyQuestStatus()

void Player::_LoadDailyQuestStatus ( PreparedQueryResult  result)
protected
6358{
6359 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
6360 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
6361
6362 m_DFQuests.clear();
6363
6364 //QueryResult* result = CharacterDatabase.Query("SELECT quest, time FROM character_queststatus_daily WHERE guid = '{}'", GetGUID().GetCounter());
6365
6366 if (result)
6367 {
6368 uint32 quest_daily_idx = 0;
6369
6370 do
6371 {
6372 Field* fields = result->Fetch();
6373 if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(fields[0].Get<uint32>()))
6374 {
6375 if (qQuest->IsDFQuest())
6376 {
6377 m_DFQuests.insert(qQuest->GetQuestId());
6378 m_lastDailyQuestTime = time_t(fields[1].Get<uint32>());
6379 continue;
6380 }
6381 }
6382
6383 if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query
6384 {
6385 LOG_ERROR("entities.player", "Player ({}) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUID().ToString());
6386 break;
6387 }
6388
6389 uint32 quest_id = fields[0].Get<uint32>();
6390
6391 // save _any_ from daily quest times (it must be after last reset anyway)
6392 m_lastDailyQuestTime = time_t(fields[1].Get<uint32>());
6393
6394 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6395 if (!quest)
6396 continue;
6397
6398 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
6399 ++quest_daily_idx;
6400
6401 LOG_DEBUG("entities.player.loading", "Daily quest ({}) cooldown for player ({})", quest_id, GetGUID().ToString());
6402 } while (result->NextRow());
6403 }
6404
6405 m_DailyQuestChanged = false;
6406}
#define PLAYER_MAX_DAILY_QUESTS
Definition Player.h:71
@ PLAYER_FIELD_DAILY_QUESTS_1
Definition UpdateFields.h:385
DFQuestsDoneList m_DFQuests
Definition Player.h:2427
Definition QuestDef.h:210
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21181

References Field::Get(), Object::GetGUID(), LOG_DEBUG, LOG_ERROR, m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, Unit::SetUInt32Value(), sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadDeclinedNames()

void Player::_LoadDeclinedNames ( PreparedQueryResult  result)
protected
4793{
4794 if (!result)
4795 return;
4796
4797 delete m_declinedname;
4799 for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
4800 m_declinedname->name[i] = (*result)[i].Get<std::string>();
4801}
#define MAX_DECLINED_NAME_CASES
Definition Unit.h:529
Definition Unit.h:532
std::string name[MAX_DECLINED_NAME_CASES]
Definition Unit.h:533

References m_declinedname, MAX_DECLINED_NAME_CASES, and DeclinedName::name.

Referenced by LoadFromDB().

◆ _LoadEntryPointData()

void Player::_LoadEntryPointData ( PreparedQueryResult  result)
protected
4866{
4867 if (!result)
4868 return;
4869
4870 Field* fields = result->Fetch();
4871 m_entryPointData.joinPos = WorldLocation(fields[4].Get<uint32>(), // Map
4872 fields[0].Get<float>(), // X
4873 fields[1].Get<float>(), // Y
4874 fields[2].Get<float>(), // Z
4875 fields[3].Get<float>()); // Orientation
4876
4877 m_entryPointData.taxiPath[0] = fields[5].Get<uint32>();
4878 m_entryPointData.taxiPath[1] = fields[6].Get<uint32>();
4879 m_entryPointData.mountSpell = fields[7].Get<uint32>();
4880}
EntryPointData m_entryPointData
Definition Player.h:2703
Definition Position.h:255
uint32 mountSpell
Definition Player.h:1062
std::array< uint32, 2 > taxiPath
Definition Player.h:1063
WorldLocation joinPos
Definition Player.h:1064

References Field::Get(), EntryPointData::joinPos, m_entryPointData, EntryPointData::mountSpell, and EntryPointData::taxiPath.

Referenced by LoadFromDB().

◆ _LoadEquipmentSets()

void Player::_LoadEquipmentSets ( PreparedQueryResult  result)
protected
4835{
4836 // SetQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '{}' ORDER BY setindex", m_guid.GetCounter());
4837 if (!result)
4838 return;
4839
4840 uint32 count = 0;
4841 do
4842 {
4843 Field* fields = result->Fetch();
4844 EquipmentSet eqSet;
4845
4846 eqSet.Guid = fields[0].Get<uint64>();
4847 uint8 index = fields[1].Get<uint8>();
4848 eqSet.Name = fields[2].Get<std::string>();
4849 eqSet.IconName = fields[3].Get<std::string>();
4850 eqSet.IgnoreMask = fields[4].Get<uint32>();
4852
4853 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
4854 eqSet.Items[i] = ObjectGuid::Create<HighGuid::Item>(fields[5 + i].Get<uint32>());
4855
4856 m_EquipmentSets[index] = eqSet;
4857
4858 ++count;
4859
4860 if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
4861 break;
4862 } while (result->NextRow());
4863}
std::uint64_t uint64
Definition Define.h:106
@ EQUIPMENT_SET_UNCHANGED
Definition Player.h:749
#define MAX_EQUIPMENT_SET_INDEX
Definition Player.h:767
@ EQUIPMENT_SLOT_END
Definition Player.h:701
EquipmentSets m_EquipmentSets
Definition Player.h:2936
Definition Player.h:756
ObjectGuid Items[EQUIPMENT_SLOT_END]
Definition Player.h:763
std::string Name
Definition Player.h:760
std::string IconName
Definition Player.h:761
EquipmentSetUpdateState state
Definition Player.h:764
uint64 Guid
Definition Player.h:759
uint32 IgnoreMask
Definition Player.h:762

References EQUIPMENT_SET_UNCHANGED, EQUIPMENT_SLOT_END, Field::Get(), EquipmentSet::Guid, EquipmentSet::IconName, EquipmentSet::IgnoreMask, EquipmentSet::Items, m_EquipmentSets, MAX_EQUIPMENT_SET_INDEX, EquipmentSet::Name, and EquipmentSet::state.

Referenced by LoadFromDB().

◆ _LoadFriendList()

void Player::_LoadFriendList ( PreparedQueryResult  result)
protected

◆ _LoadGlyphAuras()

void Player::_LoadGlyphAuras ( )
protected
5791{
5792 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
5793 {
5794 if (uint32 glyph = GetGlyph(i))
5795 {
5796 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph))
5797 {
5798 if (GlyphSlotEntry const* glyphSlotEntry = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i)))
5799 {
5800 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyphEntry->SpellId);
5801 if (glyphEntry->TypeFlags == glyphSlotEntry->TypeFlags)
5802 {
5803 if (!spellInfo->Stances)
5805 continue;
5806 }
5807 else
5808 LOG_ERROR("entities.player", "Player {} has glyph with typeflags {} in slot with typeflags {}, removing.", m_name, glyphEntry->TypeFlags, glyphSlotEntry->TypeFlags);
5809 }
5810 else
5811 LOG_ERROR("entities.player", "Player {} has not existing glyph slot entry {} on index {}", m_name, GetGlyphSlot(i), i);
5812 }
5813 else
5814 LOG_ERROR("entities.player", "Player {} has not existing glyph entry {} on index {}", m_name, glyph, i);
5815
5816 // On any error remove glyph
5817 SetGlyph(i, 0, true);
5818 }
5819 }
5820}
DBCStorage< GlyphSlotEntry > sGlyphSlotStore(GlyphSlotfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
TriggerCastFlags
Definition SpellDefines.h:132
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition SpellDefines.h:150
@ TRIGGERED_IGNORE_CASTER_AURASTATE
Will ignore shapeshift checks.
Definition SpellDefines.h:145
@ TRIGGERED_IGNORE_SHAPESHIFT
Will not adjust facing to target (if any)
Definition SpellDefines.h:144
uint32 GetGlyph(uint8 slot) const
Definition Player.h:1780
uint32 GetGlyphSlot(uint8 slot) const
Definition Player.h:1771
void SetGlyph(uint8 slot, uint32 glyph, bool save)
Definition Player.h:1772
std::string m_name
Definition Object.h:720
Definition DBCStructure.h:1022
Definition DBCStructure.h:1030

References Unit::CastSpell(), GetGlyph(), GetGlyphSlot(), LOG_ERROR, WorldObject::m_name, MAX_GLYPH_SLOT_INDEX, SetGlyph(), sGlyphPropertiesStore, sGlyphSlotStore, sSpellMgr, SpellInfo::Stances, TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_CASTER_AURASTATE, and TRIGGERED_IGNORE_SHAPESHIFT.

Referenced by LoadFromDB().

◆ _LoadGlyphs()

void Player::_LoadGlyphs ( PreparedQueryResult  result)
protected
14926{
14927 // SELECT talentGroup, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 from character_glyphs WHERE guid = '%u'
14928 if (!result)
14929 return;
14930
14931 do
14932 {
14933 Field* fields = result->Fetch();
14934
14935 uint8 spec = fields[0].Get<uint8>();
14936 if (spec >= m_specsCount)
14937 continue;
14938
14939 m_Glyphs[spec][0] = fields[1].Get<uint16>();
14940 m_Glyphs[spec][1] = fields[2].Get<uint16>();
14941 m_Glyphs[spec][2] = fields[3].Get<uint16>();
14942 m_Glyphs[spec][3] = fields[4].Get<uint16>();
14943 m_Glyphs[spec][4] = fields[5].Get<uint16>();
14944 m_Glyphs[spec][5] = fields[6].Get<uint16>();
14945 } while (result->NextRow());
14946}

References Field::Get(), m_Glyphs, and m_specsCount.

Referenced by LoadFromDB().

◆ _LoadGroup()

void Player::_LoadGroup ( )
protected
6496{
6497 if (ObjectGuid groupId = sCharacterCache->GetCharacterGroupGuidByGuid(GetGUID()))
6498 {
6499 if (Group* group = sGroupMgr->GetGroupByGUID(groupId.GetCounter()))
6500 {
6501 if (group->GetMemberGroup(GetGUID()) <= MAX_RAID_SUBGROUPS)
6502 {
6503 if (group->IsLeader(GetGUID()))
6504 {
6506 }
6507
6508 uint8 subgroup = group->GetMemberGroup(GetGUID());
6509 SetGroup(group, subgroup);
6510
6511 // the group leader may change the instance difficulty while the player is offline
6512 SetDungeonDifficulty(group->GetDungeonDifficulty());
6513 SetRaidDifficulty(group->GetRaidDifficulty());
6514 }
6515 }
6516 }
6517
6518 if (!GetGroup() || !GetGroup()->IsLeader(GetGUID()))
6520}
#define sGroupMgr
Definition GroupMgr.h:51
#define MAX_RAID_SUBGROUPS
Definition Group.h:45
@ PLAYER_FLAGS_GROUP_LEADER
Definition Player.h:480
Definition Group.h:169
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1128
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:1129
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition Player.h:1937
void SetGroup(Group *group, int8 subgroup=-1)
Definition Player.cpp:11532
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition Player.h:1938
Group * GetGroup()
Definition Player.h:2485

References GetGroup(), Object::GetGUID(), MAX_RAID_SUBGROUPS, PLAYER_FLAGS_GROUP_LEADER, RemovePlayerFlag(), sCharacterCache, SetDungeonDifficulty(), SetGroup(), SetPlayerFlag(), SetRaidDifficulty(), and sGroupMgr.

Referenced by LoadFromDB().

◆ _LoadHomeBind()

bool Player::_LoadHomeBind ( PreparedQueryResult  result)
protected
7003{
7004 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
7005 if (!info)
7006 {
7007 LOG_ERROR("entities.player", "Player (Name {}) has incorrect race/class pair. Can't be loaded.", GetName());
7008 return false;
7009 }
7010
7011 bool ok = false;
7012 // SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?
7013 if (result)
7014 {
7015 Field* fields = result->Fetch();
7016
7017 m_homebindMapId = fields[0].Get<uint16>();
7018 m_homebindAreaId = fields[1].Get<uint16>();
7019 m_homebindX = fields[2].Get<float>();
7020 m_homebindY = fields[3].Get<float>();
7021 m_homebindZ = fields[4].Get<float>();
7022
7023 MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
7024
7025 // accept saved data only for valid position (and non instanceable), and accessable
7027 !bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion())
7028 ok = true;
7029 else
7030 {
7032 stmt->SetData(0, GetGUID().GetCounter());
7033 CharacterDatabase.Execute(stmt);
7034 }
7035 }
7036
7037 if (!ok)
7038 {
7039 m_homebindMapId = info->mapId;
7040 m_homebindAreaId = info->areaId;
7041 m_homebindX = info->positionX;
7042 m_homebindY = info->positionY;
7043 m_homebindZ = info->positionZ;
7044
7046 stmt->SetData(0, GetGUID().GetCounter());
7047 stmt->SetData(1, m_homebindMapId);
7048 stmt->SetData(2, m_homebindAreaId);
7049 stmt->SetData (3, m_homebindX);
7050 stmt->SetData (4, m_homebindY);
7051 stmt->SetData (5, m_homebindZ);
7052 CharacterDatabase.Execute(stmt);
7053 }
7054
7055 LOG_DEBUG("entities.player", "Setting player home position - mapid: {}, areaid: {}, X: {}, Y: {}, Z: {}",
7057 return true;
7058}
@ CHAR_INS_PLAYER_HOMEBIND
Definition CharacterDatabase.h:242
@ CHAR_DEL_PLAYER_HOMEBIND
Definition CharacterDatabase.h:244
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
static bool IsValidMapCoord(uint32 mapid, Position const &pos)
Definition MapMgr.h:90
LowType GetCounter() const
Definition ObjectGuid.h:145
uint8 getClass() const
Definition Unit.h:793
uint8 getRace(bool original=false) const
Definition Unit.cpp:20865
uint8 Expansion() const
Definition WorldSession.h:392
Definition DBCStructure.h:1326
Definition Player.h:341
float positionX
Definition Player.h:347
uint32 areaId
Definition Player.h:346
float positionY
Definition Player.h:348
float positionZ
Definition Player.h:349
uint32 mapId
Definition Player.h:345

References PlayerInfo::areaId, CHAR_DEL_PLAYER_HOMEBIND, CHAR_INS_PLAYER_HOMEBIND, CharacterDatabase, WorldSession::Expansion(), Field::Get(), Unit::getClass(), ObjectGuid::GetCounter(), Object::GetGUID(), WorldObject::GetName(), Unit::getRace(), GetSession(), MapMgr::IsValidMapCoord(), LOG_DEBUG, LOG_ERROR, m_homebindAreaId, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, PlayerInfo::mapId, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, PreparedStatementBase::SetData(), sMapStore, and sObjectMgr.

Referenced by LoadFromDB().

◆ _LoadInstanceTimeRestrictions()

void Player::_LoadInstanceTimeRestrictions ( PreparedQueryResult  result)
protected
15738{
15739 if (!result)
15740 return;
15741
15742 do
15743 {
15744 Field* fields = result->Fetch();
15745 _instanceResetTimes.insert(InstanceTimeMap::value_type(fields[0].Get<uint32>(), fields[1].Get<uint64>()));
15746 } while (result->NextRow());
15747}
InstanceTimeMap _instanceResetTimes
Definition Player.h:3008

References _instanceResetTimes.

Referenced by LoadFromDB().

◆ _LoadInventory()

void Player::_LoadInventory ( PreparedQueryResult  result,
uint32  timeDiff 
)
protected
5843{
5844 //QueryResult* result = CharacterDatabase.Query("SELECT data, text, bag, slot, item, item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '{}' ORDER BY bag, slot", GetGUID().GetCounter());
5845 //NOTE: the "order by `bag`" is important because it makes sure
5846 //the bagMap is filled before items in the bags are loaded
5847 //NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?)
5848 //expected to be equipped before offhand items (TODO: fixme)
5849
5850 if (result)
5851 {
5852 uint32 zoneId = GetZoneId();
5853
5854 std::map<ObjectGuid::LowType, Bag*> bagMap; // fast guid lookup for bags
5855 std::map<ObjectGuid::LowType, Item*> invalidBagMap; // fast guid lookup for bags
5856 std::list<Item*> problematicItems;
5857 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
5858
5859 // Prevent items from being added to the queue while loading
5861 do
5862 {
5863 Field* fields = result->Fetch();
5864 if (Item* item = _LoadItem(trans, zoneId, timeDiff, fields))
5865 {
5866 ObjectGuid::LowType bagGuid = fields[11].Get<uint32>();
5867 uint8 slot = fields[12].Get<uint8>();
5868
5869 uint8 err = EQUIP_ERR_OK;
5870 // Item is not in bag
5871 if (!bagGuid)
5872 {
5873 item->SetContainer(nullptr);
5874 item->SetSlot(slot);
5875
5877 {
5878 ItemPosCountVec dest;
5879 err = CanStoreItem(INVENTORY_SLOT_BAG_0, slot, dest, item, false);
5880 if (err == EQUIP_ERR_OK)
5881 item = StoreItem(dest, item, true);
5882 }
5883 else if (IsEquipmentPos(INVENTORY_SLOT_BAG_0, slot))
5884 {
5885 uint16 dest;
5886 if (sScriptMgr->OnPlayerCheckItemInSlotAtLoadInventory(this, item, slot, err, dest))
5887 err = CanEquipItem(slot, dest, item, false, false);
5888 if (err == EQUIP_ERR_OK)
5889 QuickEquipItem(dest, item);
5890 }
5891 else if (IsBankPos(INVENTORY_SLOT_BAG_0, slot))
5892 {
5893 ItemPosCountVec dest;
5894 err = CanBankItem(INVENTORY_SLOT_BAG_0, slot, dest, item, false, false);
5895 if (err == EQUIP_ERR_OK)
5896 item = BankItem(dest, item, true);
5897 }
5898
5899 // Remember bags that may contain items in them
5900 if (err == EQUIP_ERR_OK)
5901 {
5902 if (IsBagPos(item->GetPos()))
5903 if (Bag* pBag = item->ToBag())
5904 bagMap[item->GetGUID().GetCounter()] = pBag;
5905 }
5906 else if (IsBagPos(item->GetPos()))
5907 if (item->IsBag())
5908 invalidBagMap[item->GetGUID().GetCounter()] = item;
5909 }
5910 else
5911 {
5912 item->SetSlot(NULL_SLOT);
5913 // Item is in the bag, find the bag
5914 std::map<ObjectGuid::LowType, Bag*>::iterator itr = bagMap.find(bagGuid);
5915 if (itr != bagMap.end())
5916 {
5917 ItemPosCountVec dest;
5918 err = CanStoreItem(itr->second->GetSlot(), slot, dest, item);
5919 if (err == EQUIP_ERR_OK)
5920 item = StoreItem(dest, item, true);
5921 }
5922 else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
5923 {
5924 std::map<ObjectGuid::LowType, Item*>::iterator iterator = invalidBagMap.find(bagGuid);
5925 if (std::find(problematicItems.begin(), problematicItems.end(), iterator->second) != problematicItems.end())
5926 {
5928 }
5929 }
5930 else
5931 {
5932 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) which doesnt have a valid bag (Bag GUID: {}, slot: {}). Possible cheat?",
5933 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), bagGuid, slot);
5934 item->DeleteFromInventoryDB(trans);
5935 delete item;
5936 continue;
5937 }
5938 }
5939
5940 // Item's state may have changed after storing
5941 if (err == EQUIP_ERR_OK)
5942 item->SetState(ITEM_UNCHANGED, this);
5943 else
5944 {
5945 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) which can't be loaded into inventory (Bag GUID: {}, slot: {}) by reason {}. Item will be sent by mail.",
5946 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), bagGuid, slot, err);
5947 item->DeleteFromInventoryDB(trans);
5948 problematicItems.push_back(item);
5949 }
5950 }
5951 } while (result->NextRow());
5952
5954
5955 // Send problematic items by mail
5956 while (!problematicItems.empty())
5957 {
5958 std::string subject = GetSession()->GetAcoreString(LANG_NOT_EQUIPPED_ITEM);
5959
5960 MailDraft draft(subject, "There were problems with equipping item(s).");
5961 for (uint8 i = 0; !problematicItems.empty() && i < MAX_MAIL_ITEMS; ++i)
5962 {
5963 draft.AddItem(problematicItems.front());
5964 problematicItems.pop_front();
5965 }
5966 draft.SendMailTo(trans, this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED);
5967 }
5968 CharacterDatabase.CommitTransaction(trans);
5969 }
5970 //if (IsAlive())
5972}
@ EQUIP_ERR_OK
Definition Item.h:47
@ EQUIP_ERR_INT_BAG_ERROR
Definition Item.h:87
@ ITEM_UNCHANGED
Definition Item.h:209
@ NULL_SLOT
Definition Item.h:41
@ LANG_NOT_EQUIPPED_ITEM
Definition Language.h:677
#define MAX_MAIL_ITEMS
Definition Mail.h:33
@ MAIL_CHECK_MASK_COPIED
This mail was returned. Do not allow returning mail back again.
Definition Mail.h:49
@ MAIL_STATIONERY_GM
Definition Mail.h:59
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:778
#define INVENTORY_SLOT_BAG_0
Definition Player.h:677
Definition Bag.h:28
Bag * ToBag()
Definition Item.h:250
uint32 LowType
Definition ObjectGuid.h:122
static bool IsEquipmentPos(uint16 pos)
Definition Player.h:1280
InventoryResult CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition PlayerStorage.cpp:1805
void QuickEquipItem(uint16 pos, Item *pItem)
Definition PlayerStorage.cpp:2835
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
Definition Player.h:1349
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition Player.h:1300
Item * StoreItem(ItemPosCountVec const &pos, Item *pItem, bool update)
Definition PlayerStorage.cpp:2574
static bool IsInventoryPos(uint16 pos)
Definition Player.h:1278
Item * _LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field *fields)
Definition PlayerStorage.cpp:5974
static bool IsBagPos(uint16 pos)
Definition PlayerStorage.cpp:590
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition PlayerStorage.cpp:2032
static bool IsBankPos(uint16 pos)
Definition Player.h:1283
uint32 GetZoneId() const
Definition Object.cpp:3021
std::string GetAcoreString(uint32 entry) const
Definition WorldSession.cpp:832

References _ApplyAllItemMods(), _LoadItem(), MailDraft::AddItem(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), CharacterDatabase, EQUIP_ERR_INT_BAG_ERROR, EQUIP_ERR_OK, Field::Get(), WorldSession::GetAcoreString(), Object::GetGUID(), WorldObject::GetName(), GetSession(), WorldObject::GetZoneId(), INVENTORY_SLOT_BAG_0, IsBagPos(), IsBankPos(), IsEquipmentPos(), IsInventoryPos(), ITEM_UNCHANGED, LANG_NOT_EQUIPPED_ITEM, LOG_ERROR, m_itemUpdateQueueBlocked, MAIL_CHECK_MASK_COPIED, MAIL_STATIONERY_GM, MAX_MAIL_ITEMS, NULL_SLOT, QuickEquipItem(), MailDraft::SendMailTo(), sScriptMgr, StoreItem(), Item::ToBag(), ObjectGuid::ToString(), and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadItem()

Item * Player::_LoadItem ( CharacterDatabaseTransaction  trans,
uint32  zoneId,
uint32  timeDiff,
Field fields 
)
private
5975{
5976 Item* item = nullptr;
5977 ObjectGuid::LowType itemGuid = fields[13].Get<uint32>();
5978 uint32 itemEntry = fields[14].Get<uint32>();
5979 if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry))
5980 {
5981 bool remove = false;
5982 item = NewItemOrBag(proto);
5983 if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
5984 {
5985 CharacterDatabasePreparedStatement* stmt = nullptr;
5986
5987 // Do not allow to have item limited to another map/zone in alive state
5988 if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
5989 {
5990 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}', map: {}) has item ({}, entry: {}) limited to another map ({}). Deleting item.",
5991 GetGUID().ToString(), GetName(), GetMapId(), item->GetGUID().ToString(), item->GetEntry(), zoneId);
5992 remove = true;
5993 }
5994 // "Conjured items disappear if you are logged out for more than 15 minutes"
5995 else if (timeDiff > 15 * MINUTE && proto->HasFlag(ITEM_FLAG_CONJURED))
5996 {
5997 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}', diff: {}) has conjured item ({}, entry: {}) with expired lifetime (15 minutes). Deleting item.",
5998 GetGUID().ToString(), GetName(), timeDiff, item->GetGUID().ToString(), item->GetEntry());
5999 remove = true;
6000 }
6001 else if (item->IsRefundable())
6002 {
6003 if (item->GetPlayedTime() > (2 * HOUR))
6004 {
6005 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with expired refund time ({}). Deleting refund data and removing refundable flag.",
6006 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), item->GetPlayedTime());
6007 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
6008 stmt->SetData(0, item->GetGUID().GetCounter());
6009 trans->Append(stmt);
6010
6012 }
6013 else
6014 {
6015 // xinef: sync query
6016 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
6017 stmt->SetData(0, item->GetGUID().GetCounter());
6018 stmt->SetData(1, GetGUID().GetCounter());
6019 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
6020 {
6021 item->SetRefundRecipient((*result)[0].Get<uint32>());
6022 item->SetPaidMoney((*result)[1].Get<uint32>());
6023 item->SetPaidExtendedCost((*result)[2].Get<uint16>());
6024 AddRefundReference(item->GetGUID());
6025 }
6026 else
6027 {
6028 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with refundable flags, but without data in item_refund_instance. Removing flag.",
6029 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry());
6031 }
6032 }
6033 }
6034 else if (item->IsBOPTradable())
6035 {
6036 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
6037 stmt->SetData(0, item->GetGUID().GetCounter());
6038
6039 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
6040 {
6041 AllowedLooterSet looters;
6042 for (std::string_view guidStr : Acore::Tokenize((*result)[0].Get<std::string_view>(), ' ', false))
6043 {
6044 if (Optional<ObjectGuid::LowType> guid = Acore::StringTo<ObjectGuid::LowType>(guidStr))
6045 {
6046 looters.insert(ObjectGuid::Create<HighGuid::Player>(*guid));
6047 }
6048 else
6049 {
6050 LOG_WARN("entities.player.loading", "Player::_LoadInventory: invalid item_soulbound_trade_data GUID '{}' for item {}. Skipped.", guidStr, item->GetGUID().ToString());
6051 }
6052 }
6053
6054 if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
6055 {
6056 item->SetSoulboundTradeable(looters);
6057 AddTradeableItem(item);
6058 }
6059 else
6060 item->ClearSoulboundTradeable(this);
6061 }
6062 else
6063 {
6064 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with ITEM_FIELD_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.",
6065 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry());
6067 }
6068 }
6069 else if (proto->HolidayId)
6070 {
6071 remove = true;
6072 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
6073 GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
6074 for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
6075 {
6076 if (uint32(events[*itr].HolidayId) == proto->HolidayId)
6077 {
6078 remove = false;
6079 break;
6080 }
6081 }
6082 }
6083 }
6084 else
6085 {
6086 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has broken item (GUID: {}, entry: {}) in inventory. Deleting item.",
6087 GetGUID().ToString(), GetName(), itemGuid, itemEntry);
6088 remove = true;
6089 }
6090 // Remove item from inventory if necessary
6091 if (remove)
6092 {
6093 Item::DeleteFromInventoryDB(trans, itemGuid);
6094 item->FSetState(ITEM_REMOVED);
6095 item->SaveToDB(trans); // it also deletes item object!
6096 item = nullptr;
6097 }
6098 }
6099 else
6100 {
6101 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has unknown item (entry: {}) in inventory. Deleting item.",
6102 GetGUID().ToString(), GetName(), itemEntry);
6103 Item::DeleteFromInventoryDB(trans, itemGuid);
6104 Item::DeleteFromDB(trans, itemGuid);
6105 }
6106 return item;
6107}
Item * NewItemOrBag(ItemTemplate const *proto)
Definition Bag.h:67
@ CHAR_DEL_ITEM_REFUND_INSTANCE
Definition CharacterDatabase.h:376
@ CHAR_SEL_ITEM_BOP_TRADE
Definition CharacterDatabase.h:120
@ CHAR_SEL_ITEM_REFUNDS
Definition CharacterDatabase.h:119
constexpr auto HOUR
Definition Common.h:48
constexpr auto MINUTE
Definition Common.h:47
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
#define sGameEventMgr
Definition GameEventMgr.h:201
@ ITEM_FIELD_FLAG_REFUNDABLE
Definition ItemTemplate.h:121
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
Definition ItemTemplate.h:117
@ ITEM_FLAG_CONJURED
Definition ItemTemplate.h:148
@ ITEM_REMOVED
Definition Item.h:212
#define LOG_WARN(filterType__,...)
Definition Log.h:162
GuidSet AllowedLooterSet
Definition LootMgr.h:151
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:24
@ ITEM_FIELD_FLAGS
Definition UpdateFields.h:42
events
Definition boss_sartura.cpp:43
std::vector< GameEventData > GameEventDataMap
Definition GameEventMgr.h:107
std::set< uint16 > ActiveEvents
Definition GameEventMgr.h:106
uint32 GetPlayedTime()
Definition Item.cpp:1246
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition Item.cpp:532
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field *fields, uint32 entry)
Definition Item.cpp:419
virtual void SaveToDB(CharacterDatabaseTransaction trans)
Definition Item.cpp:336
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
Definition Item.cpp:1056
void SetSoulboundTradeable(AllowedLooterSet &allowedLooters)
Definition Item.cpp:1258
void SetPaidMoney(uint32 money)
Definition Item.h:345
bool IsSoulBound() const
Definition Item.h:236
bool IsBOPTradable() const
Definition Item.h:262
void SetRefundRecipient(ObjectGuid::LowType pGuidLow)
Definition Item.h:344
bool IsRefundable() const
Definition Item.h:261
void FSetState(ItemUpdateState state)
Definition Item.h:330
void SetPaidExtendedCost(uint32 iece)
Definition Item.h:346
void ClearSoulboundTradeable(Player *currentOwner)
Definition Item.cpp:1264
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition Item.cpp:518
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:849
uint32 GetEntry() const
Definition Object.h:116
void AddRefundReference(ObjectGuid itemGUID)
Definition Player.cpp:15475
void AddTradeableItem(Item *item)
Definition PlayerStorage.cpp:4132
bool IsAlive() const
Definition Unit.h:1707
uint32 GetMapId() const
Definition Position.h:280
Definition AsioHacksFwd.h:47
STL namespace.
uint32 GetMaxStackSize() const
Definition ItemTemplate.h:728

References AddRefundReference(), AddTradeableItem(), CHAR_DEL_ITEM_REFUND_INSTANCE, CHAR_SEL_ITEM_BOP_TRADE, CHAR_SEL_ITEM_REFUNDS, CharacterDatabase, Item::ClearSoulboundTradeable(), Item::DeleteFromDB(), Item::DeleteFromInventoryDB(), Item::FSetState(), Field::Get(), ObjectGuid::GetCounter(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), WorldLocation::GetMapId(), ItemTemplate::GetMaxStackSize(), WorldObject::GetName(), Item::GetPlayedTime(), Item::GetTemplate(), HOUR, Unit::IsAlive(), Item::IsBOPTradable(), Item::IsLimitedToAnotherMapOrZone(), Item::IsRefundable(), Item::IsSoulBound(), ITEM_FIELD_FLAG_BOP_TRADEABLE, ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, ITEM_FLAG_CONJURED, ITEM_REMOVED, Item::LoadFromDB(), LOG_DEBUG, LOG_ERROR, LOG_WARN, MINUTE, NewItemOrBag(), Object::RemoveFlag(), Item::SaveToDB(), PreparedStatementBase::SetData(), Item::SetPaidExtendedCost(), Item::SetPaidMoney(), Item::SetRefundRecipient(), Item::SetSoulboundTradeable(), sGameEventMgr, sObjectMgr, Acore::Tokenize(), ObjectGuid::ToString(), and Position::ToString().

Referenced by _LoadInventory().

◆ _LoadMail()

void Player::_LoadMail ( PreparedQueryResult  mailsResult,
PreparedQueryResult  mailItemsResult 
)
protected
6163{
6164 time_t cur_time = GameTime::GetGameTime().count();
6165
6166 m_mail.clear();
6167
6168 std::unordered_map<uint32, Mail*> mailById;
6169
6170 if (mailsResult)
6171 {
6172 do
6173 {
6174 Field* fields = mailsResult->Fetch();
6175 Mail* m = new Mail;
6176
6177 m->messageID = fields[0].Get<uint32>();
6178 m->messageType = fields[1].Get<uint8>();
6179 m->sender = fields[2].Get<uint32>();
6180 m->receiver = fields[3].Get<uint32>();
6181 m->subject = fields[4].Get<std::string>();
6182 m->body = fields[5].Get<std::string>();
6183 m->expire_time = time_t(fields[6].Get<uint32>());
6184 m->deliver_time = time_t(fields[7].Get<uint32>());
6185 m->money = fields[8].Get<uint32>();
6186 m->COD = fields[9].Get<uint32>();
6187 m->checked = fields[10].Get<uint8>();
6188 m->stationery = fields[11].Get<uint8>();
6189 m->mailTemplateId = fields[12].Get<int16>();
6190
6191 if (cur_time > m->expire_time)
6192 {
6193 LOG_DEBUG("entities.player", "Player::_LoadMail: Mail ({}) has expired - ignored.", m->messageID);
6194 continue;
6195 }
6196
6197 if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
6198 {
6199 LOG_ERROR("entities.player", "Player::_LoadMail: Mail ({}) has nonexistent MailTemplateId ({}), remove at load", m->messageID, m->mailTemplateId);
6200 m->mailTemplateId = 0;
6201 }
6202
6204
6205 m_mail.push_back(m);
6206 mailById[m->messageID] = m;
6207 } while (mailsResult->NextRow());
6208 }
6209
6210 if (mailItemsResult)
6211 {
6212 do
6213 {
6214 Field* fields = mailItemsResult->Fetch();
6215 uint32 mailId = fields[14].Get<uint32>();
6216 _LoadMailedItem(GetGUID(), this, mailId, mailById[mailId], fields);
6217 } while (mailItemsResult->NextRow());
6218 }
6219
6221}
DBCStorage< MailTemplateEntry > sMailTemplateStore(MailTemplateEntryfmt)
std::int16_t int16
Definition Define.h:104
@ MAIL_STATE_UNCHANGED
Definition Mail.h:68
void UpdateNextMailTimeAndUnreads()
Definition PlayerUpdates.cpp:436
static Item * _LoadMailedItem(ObjectGuid const &playerGuid, Player *player, uint32 mailId, Mail *mail, Field *fields)
Definition PlayerStorage.cpp:6110
Definition Mail.h:167
ObjectGuid::LowType receiver
Definition Mail.h:173
uint8 messageType
Definition Mail.h:169
uint32 messageID
Definition Mail.h:168
time_t expire_time
Definition Mail.h:178
uint32 sender
Definition Mail.h:172
uint8 stationery
Definition Mail.h:170
std::string subject
Definition Mail.h:174
std::string body
Definition Mail.h:175
time_t deliver_time
Definition Mail.h:179
uint32 COD
Definition Mail.h:181
uint32 checked
Definition Mail.h:182
MailState state
Definition Mail.h:183
uint32 money
Definition Mail.h:180
uint16 mailTemplateId
Definition Mail.h:171

References _LoadMailedItem(), Mail::body, Mail::checked, Mail::COD, Mail::deliver_time, Mail::expire_time, Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), LOG_DEBUG, LOG_ERROR, m_mail, MAIL_STATE_UNCHANGED, Mail::mailTemplateId, Mail::messageID, Mail::messageType, Mail::money, Mail::receiver, Mail::sender, sMailTemplateStore, Mail::state, Mail::stationery, Mail::subject, and UpdateNextMailTimeAndUnreads().

Referenced by LoadFromDB().

◆ _LoadMailedItem()

Item * Player::_LoadMailedItem ( ObjectGuid const &  playerGuid,
Player player,
uint32  mailId,
Mail mail,
Field fields 
)
staticprotected
6111{
6112 ObjectGuid::LowType itemGuid = fields[11].Get<uint32>();
6113 uint32 itemEntry = fields[12].Get<uint32>();
6114
6115 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
6116 if (!proto)
6117 {
6118 LOG_ERROR("entities.player", "Player {} ({}) has unknown item in mailed items (GUID: {}, Entry: {}) in mail ({}), deleted.",
6119 player ? player->GetName() : "<unknown>", playerGuid.ToString(), itemGuid, itemEntry, mailId);
6120
6121 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
6122
6124 stmt->SetData(0, itemGuid);
6125 trans->Append(stmt);
6126
6127 CharacterDatabase.CommitTransaction(trans);
6128 return nullptr;
6129 }
6130
6131 Item* item = NewItemOrBag(proto);
6132
6133 ObjectGuid ownerGuid = fields[13].Get<uint32>() ? ObjectGuid::Create<HighGuid::Player>(fields[13].Get<uint32>()) : ObjectGuid::Empty;
6134 if (!item->LoadFromDB(itemGuid, ownerGuid, fields, itemEntry))
6135 {
6136 LOG_ERROR("entities.player", "Player::_LoadMailedItems: Item (GUID: {}) in mail ({}) doesn't exist, deleted from mail.", itemGuid, mailId);
6137
6139 stmt->SetData(0, itemGuid);
6140 CharacterDatabase.Execute(stmt);
6141
6142 item->FSetState(ITEM_REMOVED);
6143
6145 item->SaveToDB(temp);
6146 return nullptr;
6147 }
6148
6149 if (mail)
6150 {
6151 mail->AddItem(itemGuid, itemEntry);
6152 }
6153
6154 if (player)
6155 {
6156 player->AddMItem(item);
6157 }
6158
6159 return item;
6160}
@ CHAR_DEL_INVALID_MAIL_ITEM
Definition CharacterDatabase.h:113
@ CHAR_DEL_MAIL_ITEM
Definition CharacterDatabase.h:112
void AddMItem(Item *it)
Definition Player.h:1686
void AddItem(ObjectGuid::LowType itemGuidLow, uint32 item_template)
Definition Mail.h:185

References Mail::AddItem(), AddMItem(), CHAR_DEL_INVALID_MAIL_ITEM, CHAR_DEL_MAIL_ITEM, CharacterDatabase, ObjectGuid::Empty, Item::FSetState(), Field::Get(), WorldObject::GetName(), ITEM_REMOVED, Item::LoadFromDB(), LOG_ERROR, NewItemOrBag(), Item::SaveToDB(), PreparedStatementBase::SetData(), sObjectMgr, and ObjectGuid::ToString().

Referenced by _LoadMail(), and DeleteFromDB().

◆ _LoadMonthlyQuestStatus()

void Player::_LoadMonthlyQuestStatus ( PreparedQueryResult  result)
protected
6454{
6455 m_monthlyquests.clear();
6456
6457 if (result)
6458 {
6459 do
6460 {
6461 Field* fields = result->Fetch();
6462 uint32 quest_id = fields[0].Get<uint32>();
6463 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6464 if (!quest)
6465 continue;
6466
6467 m_monthlyquests.insert(quest_id);
6468 LOG_DEBUG("entities.player.loading", "Monthly quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6469 } while (result->NextRow());
6470 }
6471
6472 m_MonthlyQuestChanged = false;
6473}
QuestSet m_monthlyquests
Definition Player.h:2715

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_MonthlyQuestChanged, m_monthlyquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadPetStable()

void Player::_LoadPetStable ( uint8  petStableSlots,
PreparedQueryResult  result 
)
protected
15787{
15788 if (!petStableSlots && !result)
15789 return;
15790
15791 m_petStable = std::make_unique<PetStable>();
15792 m_petStable->MaxStabledPets = petStableSlots;
15793
15794 if (m_petStable->MaxStabledPets > MAX_PET_STABLES)
15795 {
15796 LOG_ERROR("entities.player", "Player::LoadFromDB: Player ({}) can't have more stable slots than {}, but has {} in DB",
15797 GetGUID().ToString(), MAX_PET_STABLES, m_petStable->MaxStabledPets);
15798
15799 m_petStable->MaxStabledPets = MAX_PET_STABLES;
15800 }
15801
15802 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15803 // SELECT id, entry, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ?
15804 if (result)
15805 {
15806 do
15807 {
15808 Field* fields = result->Fetch();
15809 PetStable::PetInfo petInfo;
15810 petInfo.PetNumber = fields[0].Get<uint32>();
15811 petInfo.CreatureId = fields[1].Get<uint32>();
15812 petInfo.DisplayId = fields[2].Get<uint32>();
15813 petInfo.Level = fields[3].Get<uint16>();
15814 petInfo.Experience = fields[4].Get<uint32>();
15815 petInfo.ReactState = ReactStates(fields[5].Get<uint8>());
15816 PetSaveMode slot = PetSaveMode(fields[6].Get<uint8>());
15817 petInfo.Name = fields[7].Get<std::string>();
15818 petInfo.WasRenamed = fields[8].Get<bool>();
15819 petInfo.Health = fields[9].Get<uint32>();
15820 petInfo.Mana = fields[10].Get<uint32>();
15821 petInfo.Happiness = fields[11].Get<uint32>();
15822 petInfo.ActionBar = fields[12].Get<std::string>();
15823 petInfo.LastSaveTime = fields[13].Get<uint32>();
15824 petInfo.CreatedBySpellId = fields[14].Get<uint32>();
15825 petInfo.Type = PetType(fields[15].Get<uint8>());
15826
15827 if (slot == PET_SAVE_AS_CURRENT)
15828 m_petStable->CurrentPet = std::move(petInfo);
15829 else if (slot >= PET_SAVE_FIRST_STABLE_SLOT && slot <= PET_SAVE_LAST_STABLE_SLOT)
15830 m_petStable->StabledPets[slot - 1] = std::move(petInfo);
15831 else if (slot == PET_SAVE_NOT_IN_SLOT)
15832 m_petStable->UnslottedPets.push_back(std::move(petInfo));
15833
15834 } while (result->NextRow());
15835 }
15836}
PetSaveMode
Definition PetDefines.h:40
@ PET_SAVE_FIRST_STABLE_SLOT
Definition PetDefines.h:43
@ PET_SAVE_LAST_STABLE_SLOT
Definition PetDefines.h:44
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:42
PetType
Definition PetDefines.h:30
constexpr auto MAX_PET_STABLES
Definition PetDefines.h:36
ReactStates
Definition Unit.h:548
std::unique_ptr< PetStable > m_petStable
Definition Player.h:2995
Definition PetDefines.h:212
uint32 Mana
Definition PetDefines.h:222
uint32 Happiness
Definition PetDefines.h:223
uint32 CreatedBySpellId
Definition PetDefines.h:225
uint32 Health
Definition PetDefines.h:221
uint32 CreatureId
Definition PetDefines.h:218
bool WasRenamed
Definition PetDefines.h:229
uint8 Level
Definition PetDefines.h:226
uint32 DisplayId
Definition PetDefines.h:219
ReactStates ReactState
Definition PetDefines.h:227
std::string Name
Definition PetDefines.h:215
PetType Type
Definition PetDefines.h:228
uint32 Experience
Definition PetDefines.h:220
uint32 PetNumber
Definition PetDefines.h:217
uint32 LastSaveTime
Definition PetDefines.h:224
std::string ActionBar
Definition PetDefines.h:216

References PetStable::PetInfo::ActionBar, PetStable::PetInfo::CreatedBySpellId, PetStable::PetInfo::CreatureId, PetStable::PetInfo::DisplayId, PetStable::PetInfo::Experience, Field::Get(), Object::GetGUID(), PetStable::PetInfo::Happiness, PetStable::PetInfo::Health, PetStable::PetInfo::LastSaveTime, PetStable::PetInfo::Level, LOG_ERROR, m_petStable, PetStable::PetInfo::Mana, MAX_PET_STABLES, PetStable::PetInfo::Name, PET_SAVE_AS_CURRENT, PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT, PET_SAVE_NOT_IN_SLOT, PetStable::PetInfo::PetNumber, PetStable::PetInfo::ReactState, Position::ToString(), PetStable::PetInfo::Type, and PetStable::PetInfo::WasRenamed.

Referenced by LoadFromDB().

◆ _LoadQuestStatus()

void Player::_LoadQuestStatus ( PreparedQueryResult  result)
protected
6236{
6237 uint16 slot = 0;
6238
6240 //QueryResult* result = CharacterDatabase.Query("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3,
6241 // 11 12 13 14
6242 // itemcount4, itemcount5, itemcount6, playercount FROM character_queststatus WHERE guid = '{}'", GetGUID().GetCounter());
6243
6244 if (result)
6245 {
6246 do
6247 {
6248 Field* fields = result->Fetch();
6249
6250 uint32 quest_id = fields[0].Get<uint32>();
6251 // used to be new, no delete?
6252 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6253 if (quest)
6254 {
6255 // find or create
6256 QuestStatusData& questStatusData = m_QuestStatus[quest_id];
6257
6258 uint8 qstatus = fields[1].Get<uint8>();
6259 if (qstatus < MAX_QUEST_STATUS)
6260 questStatusData.Status = QuestStatus(qstatus);
6261 else
6262 {
6263 questStatusData.Status = QUEST_STATUS_INCOMPLETE;
6264 LOG_ERROR("entities.player", "Player {} ({}) has invalid quest {} status ({}), replaced by QUEST_STATUS_INCOMPLETE(3).",
6265 GetName(), GetGUID().ToString(), quest_id, qstatus);
6266 }
6267
6268 questStatusData.Explored = (fields[2].Get<uint8>() > 0);
6269
6270 time_t quest_time = time_t(fields[3].Get<uint32>());
6271
6272 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id))
6273 {
6274 AddTimedQuest(quest_id);
6275
6276 if (quest_time <= GameTime::GetGameTime().count())
6277 questStatusData.Timer = 1;
6278 else
6279 questStatusData.Timer = uint32((quest_time - GameTime::GetGameTime().count()) * IN_MILLISECONDS);
6280 }
6281 else
6282 quest_time = 0;
6283
6284 for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
6285 questStatusData.CreatureOrGOCount[i] = fields[4 + i].Get<uint16>();
6286
6287 for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
6288 questStatusData.ItemCount[i] = fields[8 + i].Get<uint16>();
6289
6290 questStatusData.PlayerCount = fields[14].Get<uint16>();
6291
6292 // add to quest log
6293 if (slot < MAX_QUEST_LOG_SIZE && questStatusData.Status != QUEST_STATUS_NONE)
6294 {
6295 SetQuestSlot(slot, quest_id, uint32(quest_time)); // cast can't be helped
6296
6297 if (questStatusData.Status == QUEST_STATUS_COMPLETE)
6299 else if (questStatusData.Status == QUEST_STATUS_FAILED)
6301
6302 for (uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
6303 if (questStatusData.CreatureOrGOCount[idx])
6304 SetQuestSlotCounter(slot, idx, questStatusData.CreatureOrGOCount[idx]);
6305
6306 if (questStatusData.PlayerCount)
6307 SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.PlayerCount);
6308
6309 ++slot;
6310 }
6311
6312 LOG_DEBUG("entities.player.loading", "Quest status is {{}} for quest {{}} for player ({})", questStatusData.Status, quest_id, GetGUID().ToString());
6313 }
6314 } while (result->NextRow());
6315 }
6316
6317 // clear quest log tail
6318 for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i)
6319 SetQuestSlot(i, 0);
6320}
@ QUEST_STATE_COMPLETE
Definition Player.h:640
@ QUEST_STATE_FAIL
Definition Player.h:641
#define QUEST_ITEM_OBJECTIVES_COUNT
Definition QuestDef.h:36
#define QUEST_OBJECTIVES_COUNT
Definition QuestDef.h:35
#define MAX_QUEST_LOG_SIZE
Definition QuestDef.h:33
#define QUEST_PVP_KILL_SLOT
Definition QuestDef.h:43
QuestStatus
Definition QuestDef.h:99
@ QUEST_STATUS_FAILED
Definition QuestDef.h:105
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:103
@ QUEST_STATUS_NONE
Definition QuestDef.h:100
@ MAX_QUEST_STATUS
Definition QuestDef.h:107
@ QUEST_STATUS_COMPLETE
Definition QuestDef.h:101
@ QUEST_SPECIAL_FLAGS_TIMED
Definition QuestDef.h:178
QuestStatusMap m_QuestStatus
Definition Player.h:2814
bool GetQuestRewardStatus(uint32 quest_id) const
Definition PlayerQuest.cpp:1415
void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count)
Definition Player.h:1511
void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer=0)
Definition Player.h:1503
void SetQuestSlotState(uint16 slot, uint32 state)
Definition Player.h:1518
void AddTimedQuest(uint32 quest_id)
Definition Player.h:1570
Definition QuestDef.h:407
uint32 Timer
Definition QuestDef.h:415
uint16 PlayerCount
Definition QuestDef.h:418
uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT]
Definition QuestDef.h:416
QuestStatus Status
Definition QuestDef.h:414
bool Explored
Definition QuestDef.h:419
uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT]
Definition QuestDef.h:417

References AddTimedQuest(), QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetName(), GetQuestRewardStatus(), IN_MILLISECONDS, QuestStatusData::ItemCount, LOG_DEBUG, LOG_ERROR, m_QuestStatus, MAX_QUEST_LOG_SIZE, MAX_QUEST_STATUS, QuestStatusData::PlayerCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_PVP_KILL_SLOT, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATE_COMPLETE, QUEST_STATE_FAIL, QUEST_STATUS_COMPLETE, QUEST_STATUS_FAILED, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, SetQuestSlot(), SetQuestSlotCounter(), SetQuestSlotState(), sObjectMgr, QuestStatusData::Status, QuestStatusData::Timer, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadQuestStatusRewarded()

void Player::_LoadQuestStatusRewarded ( PreparedQueryResult  result)
protected
6323{
6324 // SELECT quest FROM character_queststatus_rewarded WHERE guid = ?
6325
6326 if (result)
6327 {
6328 m_RewardedQuests.rehash(result->GetRowCount());
6329 do
6330 {
6331 Field* fields = result->Fetch();
6332
6333 uint32 quest_id = fields[0].Get<uint32>();
6334 // used to be new, no delete?
6335 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6336 if (quest)
6337 {
6338 // learn rewarded spell if unknown
6340
6341 // set rewarded title if any
6342 if (quest->GetCharTitleId())
6343 {
6344 if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(quest->GetCharTitleId()))
6345 SetTitle(titleEntry);
6346 }
6347
6348 if (quest->GetBonusTalents())
6349 m_questRewardTalentCount += quest->GetBonusTalents();
6350 }
6351
6352 m_RewardedQuests.insert(quest_id);
6353 } while (result->NextRow());
6354 }
6355}
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
RewardedQuestSet m_RewardedQuests
Definition Player.h:2817
void SetTitle(CharTitlesEntry const *title, bool lost=false)
Definition Player.cpp:13301
void learnQuestRewardedSpells()
Definition Player.cpp:11948
Definition DBCStructure.h:632

References Field::Get(), learnQuestRewardedSpells(), m_questRewardTalentCount, m_RewardedQuests, sCharTitlesStore, SetTitle(), and sObjectMgr.

Referenced by LoadFromDB().

◆ _LoadRandomBGStatus()

void Player::_LoadRandomBGStatus ( PreparedQueryResult  result)
protected
15685{
15686 if (result)
15687 m_IsBGRandomWinner = true;
15688}

References m_IsBGRandomWinner.

Referenced by LoadFromDB().

◆ _LoadSeasonalQuestStatus()

void Player::_LoadSeasonalQuestStatus ( PreparedQueryResult  result)
protected
6431{
6432 m_seasonalquests.clear();
6433
6434 if (result)
6435 {
6436 do
6437 {
6438 Field* fields = result->Fetch();
6439 uint32 quest_id = fields[0].Get<uint32>();
6440 uint32 event_id = fields[1].Get<uint32>();
6441 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6442 if (!quest)
6443 continue;
6444
6445 m_seasonalquests[event_id].insert(quest_id);
6446 LOG_DEBUG("entities.player.loading", "Seasonal quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6447 } while (result->NextRow());
6448 }
6449
6450 m_SeasonalQuestChanged = false;
6451}
SeasonalEventQuestMap m_seasonalquests
Definition Player.h:2716

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_SeasonalQuestChanged, m_seasonalquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSkills()

void Player::_LoadSkills ( PreparedQueryResult  result)
protected
13639{
13640 // 0 1 2
13641 // SetQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '{}'", m_guid.GetCounter());
13642
13643 uint32 count = 0;
13644 std::unordered_map<uint32, uint32> loadedSkillValues;
13645 if (result)
13646 {
13647 do
13648 {
13649 Field* fields = result->Fetch();
13650 uint16 skill = fields[0].Get<uint16>();
13651 uint16 value = fields[1].Get<uint16>();
13652 uint16 max = fields[2].Get<uint16>();
13653
13654 SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill, getRace(), getClass());
13655 if (!rcEntry)
13656 {
13657 LOG_ERROR("entities.player", "Player {} (GUID: {}), has skill ({}) that is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
13658 GetName(), GetGUID().GetCounter(), skill, getRace(), getClass());
13659
13660 // Mark skill for deletion in the database
13661 mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(0, SKILL_DELETED)));
13662 continue;
13663 }
13664
13665 // set fixed skill ranges
13666 switch (GetSkillRangeType(rcEntry))
13667 {
13668 case SKILL_RANGE_LANGUAGE: // 300..300
13669 value = max = 300;
13670 break;
13671 case SKILL_RANGE_MONO: // 1..1, grey monolite bar
13672 value = max = 1;
13673 break;
13674 case SKILL_RANGE_LEVEL:
13676 default:
13677 break;
13678 }
13679
13680 if (value == 0)
13681 {
13682 LOG_ERROR("entities.player", "Player {} (GUID: {}), has skill ({}) with value 0. Will be deleted.",
13683 GetName(), GetGUID().GetCounter(), skill);
13684
13686
13687 stmt->SetData(0, GetGUID().GetCounter());
13688 stmt->SetData(1, skill);
13689
13690 CharacterDatabase.Execute(stmt);
13691
13692 continue;
13693 }
13694
13695 uint16 skillStep = 0;
13696 if (SkillTiersEntry const* skillTier = sSkillTiersStore.LookupEntry(rcEntry->SkillTierID))
13697 {
13698 for (uint32 i = 0; i < MAX_SKILL_STEP; ++i)
13699 {
13700 if (skillTier->Value[skillStep] == max)
13701 {
13702 skillStep = i + 1;
13703 break;
13704 }
13705 }
13706 }
13707
13708 SetUInt32Value(PLAYER_SKILL_INDEX(count), MAKE_PAIR32(skill, skillStep));
13709
13712
13713 mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
13714
13715 loadedSkillValues[skill] = value;
13716
13717 ++count;
13718
13719 if (count >= PLAYER_MAX_SKILLS) // client limit
13720 {
13721 LOG_ERROR("entities.player", "Character {} has more than {} skills.", GetGUID().ToString(), PLAYER_MAX_SKILLS);
13722 break;
13723 }
13724 } while (result->NextRow());
13725 }
13726
13727 // Learn skill rewarded spells after all skills have been loaded to prevent learning a skill from them before its loaded with proper value from DB
13728 for (auto& skill : loadedSkillValues)
13729 {
13730 learnSkillRewardedSpells(skill.first, skill.second);
13731 }
13732
13733 for (; count < PLAYER_MAX_SKILLS; ++count)
13734 {
13738 }
13739}
@ CHAR_DEL_CHARACTER_SKILL
Definition CharacterDatabase.h:318
SkillRaceClassInfoEntry const * GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_)
Definition DBCStores.cpp:895
DBCStorage< SkillTiersEntry > sSkillTiersStore(SkillTiersfmt)
#define MAX_SKILL_STEP
Definition DBCStructure.h:1581
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition ObjectDefines.h:89
SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const *rcEntry)
Definition ObjectMgr.cpp:9073
@ SKILL_RANGE_MONO
Definition ObjectMgr.h:675
@ SKILL_RANGE_LANGUAGE
Definition ObjectMgr.h:673
@ SKILL_RANGE_LEVEL
Definition ObjectMgr.h:674
#define PLAYER_SKILL_BONUS_INDEX(x)
Definition Player.h:80
#define PLAYER_SKILL_VALUE_INDEX(x)
Definition Player.h:79
#define PLAYER_SKILL_INDEX(x)
Definition Player.h:78
#define PLAYER_MAX_SKILLS
Definition Player.h:70
@ SKILL_DELETED
Definition Player.h:649
@ SKILL_UNCHANGED
Definition Player.h:646
#define MAKE_SKILL_VALUE(v, m)
Definition Player.h:84
SkillStatusMap mSkillStatus
Definition Player.h:2821
void learnSkillRewardedSpells(uint32 id, uint32 value)
Definition Player.cpp:11961
Definition DBCStructure.h:1570
Definition Player.h:653
Definition DBCStructure.h:1616

References CHAR_DEL_CHARACTER_SKILL, CharacterDatabase, Field::Get(), Unit::getClass(), Object::GetGUID(), GetMaxSkillValueForLevel(), WorldObject::GetName(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), learnSkillRewardedSpells(), LOG_ERROR, MAKE_PAIR32(), MAKE_SKILL_VALUE, MAX_SKILL_STEP, mSkillStatus, PLAYER_MAX_SKILLS, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_INDEX, PLAYER_SKILL_VALUE_INDEX, PreparedStatementBase::SetData(), Unit::SetUInt32Value(), SKILL_DELETED, SKILL_RANGE_LANGUAGE, SKILL_RANGE_LEVEL, SKILL_RANGE_MONO, SKILL_UNCHANGED, sSkillTiersStore, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSpellCooldowns()

void Player::_LoadSpellCooldowns ( PreparedQueryResult  result)
3613{
3614 // some cooldowns can be already set at aura loading...
3615
3616 //QueryResult* result = CharacterDatabase.Query("SELECT spell, category, item, time FROM character_spell_cooldown WHERE guid = '{}'", GetGUID().GetCounter()());
3617
3618 if (result)
3619 {
3620 time_t curTime = GameTime::GetGameTime().count();
3621
3622 do
3623 {
3624 Field* fields = result->Fetch();
3625 uint32 spell_id = fields[0].Get<uint32>();
3626 uint16 category = fields[1].Get<uint16>();
3627 uint32 item_id = fields[2].Get<uint32>();
3628 uint32 db_time = fields[3].Get<uint32>();
3629 bool needSend = fields[4].Get<bool>();
3630
3631 if (!sSpellMgr->GetSpellInfo(spell_id))
3632 {
3633 LOG_ERROR("entities.player", "Player {} has unknown spell {} in `character_spell_cooldown`, skipping.", GetGUID().ToString(), spell_id);
3634 continue;
3635 }
3636
3637 // skip outdated cooldown
3638 if (db_time <= curTime)
3639 continue;
3640
3641 _AddSpellCooldown(spell_id, category, item_id, (db_time - curTime) * IN_MILLISECONDS, needSend);
3642
3643 LOG_DEBUG("entities.player.loading", "Player ({}) spell {}, item {} cooldown loaded ({} secs).", GetGUID().ToString(), spell_id, item_id, uint32(db_time - curTime));
3644 } while (result->NextRow());
3645 }
3646}
void _AddSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition Player.cpp:11044

References _AddSpellCooldown(), Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), IN_MILLISECONDS, LOG_DEBUG, LOG_ERROR, sSpellMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSpells()

void Player::_LoadSpells ( PreparedQueryResult  result)
protected
6476{
6477 //QueryResult* result = CharacterDatabase.Query("SELECT spell, specMask FROM character_spell WHERE guid = '{}'", GetGUID().GetCounter());
6478
6479 if (result)
6480 {
6481 do
6482 {
6483 Field* fields = result->Fetch();
6484 uint32 spellId = fields[0].Get<uint32>();
6485 uint8 specMask = fields[1].Get<uint8>();
6486
6487 if (CheckSkillLearnedBySpell(spellId))
6488 addSpell(spellId, specMask, true);
6489 else
6490 removeSpell(spellId, SPEC_MASK_ALL, false);
6491 } while (result->NextRow());
6492 }
6493}
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition Player.cpp:3357
bool addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary=false, bool learnFromSkill=false)
Definition Player.cpp:3062
bool CheckSkillLearnedBySpell(uint32 spellId)
Definition Player.cpp:3109

References addSpell(), CheckSkillLearnedBySpell(), Field::Get(), removeSpell(), and SPEC_MASK_ALL.

Referenced by LoadFromDB().

◆ _LoadTalents()

void Player::_LoadTalents ( PreparedQueryResult  result)
protected
14975{
14976 // SetQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT spell, specMask FROM character_talent WHERE guid = '{}'", m_guid.GetCounter());
14977 if (result)
14978 {
14979 do
14980 {
14981 // xinef: checked
14982 uint32 spellId = (*result)[0].Get<uint32>();
14983 uint8 specMask = (*result)[1].Get<uint8>();
14984 addTalent(spellId, specMask, 0);
14985 TalentSpellPos const* talentPos = GetTalentSpellPos(spellId);
14986 ASSERT(talentPos);
14987
14988 } while (result->NextRow());
14989 }
14990}
TalentSpellPos const * GetTalentSpellPos(uint32 spellId)
Definition DBCStores.cpp:677
#define ASSERT
Definition Errors.h:68
bool addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank)
Definition Player.cpp:2911
Definition DBCStructure.h:2233

References addTalent(), ASSERT, and GetTalentSpellPos().

Referenced by LoadFromDB().

◆ _LoadWeeklyQuestStatus()

void Player::_LoadWeeklyQuestStatus ( PreparedQueryResult  result)
protected
6409{
6410 m_weeklyquests.clear();
6411
6412 if (result)
6413 {
6414 do
6415 {
6416 Field* fields = result->Fetch();
6417 uint32 quest_id = fields[0].Get<uint32>();
6418 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6419 if (!quest)
6420 continue;
6421
6422 m_weeklyquests.insert(quest_id);
6423 LOG_DEBUG("entities.player.loading", "Weekly quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6424 } while (result->NextRow());
6425 }
6426
6427 m_WeeklyQuestChanged = false;
6428}
QuestSet m_weeklyquests
Definition Player.h:2714

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_WeeklyQuestChanged, m_weeklyquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _RemoveAllItemMods()

void Player::_RemoveAllItemMods ( )
7529{
7530 LOG_DEBUG("entities.player.items", "_RemoveAllItemMods start.");
7531
7532 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7533 {
7534 if (m_items[i])
7535 {
7536 ItemTemplate const* proto = m_items[i]->GetTemplate();
7537 if (!proto)
7538 continue;
7539
7540 // item set bonuses not dependent from item broken state
7541 if (proto->ItemSet)
7542 RemoveItemsSetItem(this, proto);
7543
7544 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7545 continue;
7546
7547 ApplyItemEquipSpell(m_items[i], false);
7548 ApplyEnchantment(m_items[i], false);
7549 }
7550 }
7551
7552 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7553 {
7554 if (m_items[i])
7555 {
7556 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7557 continue;
7558 ItemTemplate const* proto = m_items[i]->GetTemplate();
7559 if (!proto)
7560 continue;
7561
7562 uint32 attacktype = Player::GetAttackBySlot(i);
7563 if (attacktype < MAX_ATTACK)
7565
7566 _ApplyItemBonuses(proto, i, false);
7567
7568 if (i == EQUIPMENT_SLOT_RANGED)
7570 }
7571 }
7572
7573 LOG_DEBUG("entities.player.items", "_RemoveAllItemMods complete.");
7574}
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
Definition Item.cpp:118

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), ApplyEnchantment(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, ItemTemplate::ItemSet, LOG_DEBUG, m_items, MAX_ATTACK, and RemoveItemsSetItem().

Referenced by _RemoveAllStatBonuses().

◆ _RemoveAllStatBonuses()

void Player::_RemoveAllStatBonuses ( )
1021{
1022 SetCanModifyStats(false);
1023
1026
1027 SetCanModifyStats(true);
1028
1030}
void _RemoveAllItemMods()
Definition Player.cpp:7528
void _RemoveAllAuraStatMods()
Definition Unit.cpp:5538

References Unit::_RemoveAllAuraStatMods(), _RemoveAllItemMods(), Unit::SetCanModifyStats(), and UpdateAllStats().

Referenced by InitStatsForLevel().

◆ _removeTalent() [1/2]

void Player::_removeTalent ( PlayerTalentMap::iterator &  itr,
uint8  specMask 
)
2982{
2983 // xinef: remove spec mask from iterator
2984 itr->second->specMask &= ~specMask;
2985
2986 // xinef: if talent is not present in any spec - remove
2987 if (itr->second->specMask == 0)
2988 {
2989 if (itr->second->State == PLAYERSPELL_NEW)
2990 {
2991 delete itr->second;
2992 m_talents.erase(itr);
2993 return;
2994 }
2995 else
2996 itr->second->State = PLAYERSPELL_REMOVED;
2997 }
2998 // xinef: otherwise save changes to DB
2999 else if (itr->second->State != PLAYERSPELL_NEW)
3000 itr->second->State = PLAYERSPELL_CHANGED;
3001}

References m_talents, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, and PLAYERSPELL_REMOVED.

Referenced by _removeTalent(), addTalent(), and resetTalents().

◆ _removeTalent() [2/2]

void Player::_removeTalent ( uint32  spellId,
uint8  specMask 
)
2973{
2974 PlayerTalentMap::iterator itr = m_talents.find(spellId);
2975 if (itr == m_talents.end() || itr->second->State == PLAYERSPELL_REMOVED)
2976 return;
2977
2978 _removeTalent(itr, specMask);
2979}
void _removeTalent(PlayerTalentMap::iterator &itr, uint8 specMask)
Definition Player.cpp:2981

References _removeTalent(), m_talents, and PLAYERSPELL_REMOVED.

◆ _removeTalentAurasAndSpells()

void Player::_removeTalentAurasAndSpells ( uint32  spellId)
3004{
3005 RemoveOwnedAura(spellId);
3006
3007 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
3008 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3009 {
3010 // pussywizard: remove pet auras
3011 if (PetAura const* petSpell = sSpellMgr->GetPetAura(spellId, i))
3012 RemovePetAura(petSpell);
3013
3014 // pussywizard: remove all triggered auras
3015 if (spellInfo->Effects[i].TriggerSpell > 0)
3016 RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell);
3017
3018 // xinef: remove temporary spells added by talent
3019 // xinef: recursively remove all learnt spells
3020 if (spellInfo->Effects[i].TriggerSpell > 0 && spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
3021 {
3022 removeSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true);
3023 _removeTalentAurasAndSpells(spellInfo->Effects[i].TriggerSpell);
3024 }
3025 }
3026}
Definition SpellMgr.h:470
void _removeTalentAurasAndSpells(uint32 spellId)
Definition Player.cpp:3003
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4761
void RemovePetAura(PetAura const *petSpell)
Definition Unit.cpp:17383
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4965

References _removeTalentAurasAndSpells(), SpellInfo::Effects, MAX_SPELL_EFFECTS, Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), Unit::RemovePetAura(), removeSpell(), SPEC_MASK_ALL, SPELL_EFFECT_LEARN_SPELL, and sSpellMgr.

Referenced by _removeTalentAurasAndSpells(), ActivateSpec(), addTalent(), and resetTalents().

◆ _SaveActions()

void Player::_SaveActions ( CharacterDatabaseTransaction  trans)
protected
7150{
7151 CharacterDatabasePreparedStatement* stmt = nullptr;
7152
7153 for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();)
7154 {
7155 switch (itr->second.uState)
7156 {
7157 case ACTIONBUTTON_NEW:
7158 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
7159 stmt->SetData(0, GetGUID().GetCounter());
7160 stmt->SetData(1, m_activeSpec);
7161 stmt->SetData(2, itr->first);
7162 stmt->SetData(3, itr->second.GetAction());
7163 stmt->SetData(4, uint8(itr->second.GetType()));
7164 trans->Append(stmt);
7165
7166 itr->second.uState = ACTIONBUTTON_UNCHANGED;
7167 ++itr;
7168 break;
7170 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION);
7171 stmt->SetData(0, itr->second.GetAction());
7172 stmt->SetData(1, uint8(itr->second.GetType()));
7173 stmt->SetData(2, GetGUID().GetCounter());
7174 stmt->SetData(3, itr->first);
7175 stmt->SetData(4, m_activeSpec);
7176 trans->Append(stmt);
7177
7178 itr->second.uState = ACTIONBUTTON_UNCHANGED;
7179 ++itr;
7180 break;
7182 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC);
7183 stmt->SetData(0, GetGUID().GetCounter());
7184 stmt->SetData(1, itr->first);
7185 stmt->SetData(2, m_activeSpec);
7186 trans->Append(stmt);
7187
7188 m_actionButtons.erase(itr++);
7189 break;
7190 default:
7191 ++itr;
7192 break;
7193 }
7194 }
7195}
@ CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC
Definition CharacterDatabase.h:434
@ CHAR_UPD_CHAR_ACTION
Definition CharacterDatabase.h:433
@ CHAR_INS_CHAR_ACTION
Definition CharacterDatabase.h:432
@ ACTIONBUTTON_NEW
Definition Player.h:224
@ ACTIONBUTTON_CHANGED
Definition Player.h:223

References ACTIONBUTTON_CHANGED, ACTIONBUTTON_DELETED, ACTIONBUTTON_NEW, ACTIONBUTTON_UNCHANGED, CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC, CHAR_INS_CHAR_ACTION, CHAR_UPD_CHAR_ACTION, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_actionButtons, m_activeSpec, and PreparedStatementBase::SetData().

Referenced by ActivateSpec(), SaveToDB(), and UpdateSpecCount().

◆ _SaveAuras()

void Player::_SaveAuras ( CharacterDatabaseTransaction  trans,
bool  logout 
)
protected
7198{
7200 stmt->SetData(0, GetGUID().GetCounter());
7201 trans->Append(stmt);
7202
7203 for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
7204 {
7205 if (!itr->second->CanBeSaved())
7206 continue;
7207
7208 Aura* aura = itr->second;
7209 if (!logout && aura->GetDuration() < 60 * IN_MILLISECONDS )
7210 continue;
7211
7212 int32 damage[MAX_SPELL_EFFECTS];
7213 int32 baseDamage[MAX_SPELL_EFFECTS];
7214 uint8 effMask = 0;
7215 uint8 recalculateMask = 0;
7216 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
7217 {
7218 if (AuraEffect const* effect = aura->GetEffect(i))
7219 {
7220 baseDamage[i] = effect->GetBaseAmount();
7221 damage[i] = effect->GetAmount();
7222 effMask |= 1 << i;
7223 if (effect->CanBeRecalculated())
7224 recalculateMask |= 1 << i;
7225 }
7226 else
7227 {
7228 baseDamage[i] = 0;
7229 damage[i] = 0;
7230 }
7231 }
7232
7233 uint8 index = 0;
7234 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
7235 stmt->SetData(index++, GetGUID().GetCounter());
7236 stmt->SetData(index++, itr->second->GetCasterGUID().GetRawValue());
7237 stmt->SetData(index++, itr->second->GetCastItemGUID().GetRawValue());
7238 stmt->SetData(index++, itr->second->GetId());
7239 stmt->SetData(index++, effMask);
7240 stmt->SetData(index++, recalculateMask);
7241 stmt->SetData(index++, itr->second->GetStackAmount());
7242 stmt->SetData(index++, damage[0]);
7243 stmt->SetData(index++, damage[1]);
7244 stmt->SetData(index++, damage[2]);
7245 stmt->SetData(index++, baseDamage[0]);
7246 stmt->SetData(index++, baseDamage[1]);
7247 stmt->SetData(index++, baseDamage[2]);
7248 stmt->SetData(index++, itr->second->GetMaxDuration());
7249 stmt->SetData(index++, itr->second->GetDuration());
7250 stmt->SetData(index, itr->second->GetCharges());
7251 trans->Append(stmt);
7252 }
7253}
@ CHAR_INS_AURA
Definition CharacterDatabase.h:196
@ CHAR_DEL_CHAR_AURA
Definition CharacterDatabase.h:409
Definition SpellAuraEffects.h:39
int32 GetDuration() const
Definition SpellAuras.h:133
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:175
AuraMap m_ownedAuras
Definition Unit.h:2080

References CHAR_DEL_CHAR_AURA, CHAR_INS_AURA, CharacterDatabase, ObjectGuid::GetCounter(), Aura::GetDuration(), Aura::GetEffect(), Object::GetGUID(), IN_MILLISECONDS, Unit::m_ownedAuras, MAX_SPELL_EFFECTS, and PreparedStatementBase::SetData().

Referenced by SaveToDB(), and SpawnCorpseBones().

◆ _SaveCharacter()

void Player::_SaveCharacter ( bool  create,
CharacterDatabaseTransaction  trans 
)
protected

Insert query TO DO: Filter out more redundant fields that can take their default value at player create

14650{
14651 CharacterDatabasePreparedStatement* stmt = nullptr;
14652 uint8 index = 0;
14653
14654 auto finiteAlways = [](float f) { return std::isfinite(f) ? f : 0.0f; };
14655
14656 if (create)
14657 {
14660 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER);
14661 stmt->SetData(index++, GetGUID().GetCounter());
14662 stmt->SetData(index++, GetSession()->GetAccountId());
14663 stmt->SetData(index++, GetName());
14664 stmt->SetData(index++, getRace(true));
14665 stmt->SetData(index++, getClass());
14666 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
14667 stmt->SetData(index++, GetLevel());
14668 stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
14669 stmt->SetData(index++, GetMoney());
14670 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
14671 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 1));
14672 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 2));
14673 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 3));
14674 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
14675 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
14676 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
14677 stmt->SetData(index++, (uint32)GetPlayerFlags());
14678 stmt->SetData(index++, (uint16)GetMapId());
14679 stmt->SetData(index++, (uint32)GetInstanceId());
14680 stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
14681 stmt->SetData(index++, finiteAlways(GetPositionX()));
14682 stmt->SetData(index++, finiteAlways(GetPositionY()));
14683 stmt->SetData(index++, finiteAlways(GetPositionZ()));
14684 stmt->SetData(index++, finiteAlways(GetOrientation()));
14685 stmt->SetData(index++, finiteAlways(GetTransOffsetX()));
14686 stmt->SetData(index++, finiteAlways(GetTransOffsetY()));
14687 stmt->SetData(index++, finiteAlways(GetTransOffsetZ()));
14688 stmt->SetData(index++, finiteAlways(GetTransOffsetO()));
14689
14690 int32 lowGuidOrSpawnId = 0;
14691 if (Transport* transport = GetTransport())
14692 {
14693 if (transport->IsMotionTransport())
14694 lowGuidOrSpawnId = static_cast<int32>(transport->GetGUID().GetCounter());
14695 else if (transport->IsStaticTransport())
14696 lowGuidOrSpawnId = -static_cast<int32>(transport->GetSpawnId());
14697 }
14698 stmt->SetData(index++, lowGuidOrSpawnId);
14699
14700 std::ostringstream ss;
14701 ss << m_taxi;
14702 stmt->SetData(index++, ss.str());
14703 stmt->SetData(index++, m_cinematic);
14704 stmt->SetData(index++, m_Played_time[PLAYED_TIME_TOTAL]);
14705 stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
14706 stmt->SetData(index++, finiteAlways(_restBonus));
14707 stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
14708 stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
14709 //save, far from tavern/city
14710 //save, but in tavern/city
14711 stmt->SetData(index++, m_resetTalentsCost);
14712 stmt->SetData(index++, uint32(m_resetTalentsTime));
14713 stmt->SetData(index++, (uint16)m_ExtraFlags);
14714 stmt->SetData(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
14715 stmt->SetData(index++, (uint16)m_atLoginFlags);
14716 stmt->SetData(index++, GetZoneId());
14717 stmt->SetData(index++, uint32(m_deathExpireTime));
14718
14719 ss.str("");
14721
14722 stmt->SetData(index++, ss.str());
14723 stmt->SetData(index++, GetArenaPoints());
14724 stmt->SetData(index++, GetHonorPoints());
14728 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
14729 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
14733 stmt->SetData(index++, GetDrunkValue());
14734 stmt->SetData(index++, GetHealth());
14735
14736 for (uint32 i = 0; i < MAX_POWERS; ++i)
14737 stmt->SetData(index++, GetPower(Powers(i)));
14738
14739 stmt->SetData(index++, GetSession()->GetLatency());
14740
14741 stmt->SetData(index++, m_specsCount);
14742 stmt->SetData(index++, m_activeSpec);
14743
14744 ss.str("");
14745 for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
14746 ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
14747 stmt->SetData(index++, ss.str());
14748
14749 ss.str("");
14750 // cache equipment...
14751 for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
14753
14754 // ...and bags for enum opcode
14756 {
14757 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
14758 ss << item->GetEntry();
14759 else
14760 ss << '0';
14761 ss << " 0 ";
14762 }
14763
14764 stmt->SetData(index++, ss.str());
14765 stmt->SetData(index++, GetUInt32Value(PLAYER_AMMO_ID));
14766
14767 ss.str("");
14768 for (uint32 i = 0; i < KNOWN_TITLES_SIZE * 2; ++i)
14770
14771 stmt->SetData(index++, ss.str());
14772 stmt->SetData(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
14773 stmt->SetData(index++, m_grantableLevels);
14774 stmt->SetData(index++, _innTriggerId);
14775 stmt->SetData(index++, m_extraBonusTalentCount);
14776 }
14777 else
14778 {
14779 // Update query
14780 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER);
14781 stmt->SetData(index++, GetName());
14782 stmt->SetData(index++, getRace(true));
14783 stmt->SetData(index++, getClass());
14784 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
14785 stmt->SetData(index++, GetLevel());
14786 stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
14787 stmt->SetData(index++, GetMoney());
14788 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
14789 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 1));
14790 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 2));
14791 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 3));
14792 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
14793 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
14794 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
14795 stmt->SetData(index++, GetPlayerFlags());
14796
14797 if (!IsBeingTeleported())
14798 {
14800 if (Map* m = FindMap())
14801 if (m->IsDungeon())
14802 {
14803 if (m->IsNonRaidDungeon()) dd = m->GetDifficulty();
14804 else rd = m->GetDifficulty();
14805 }
14806 stmt->SetData(index++, (uint16)GetMapId());
14807 stmt->SetData(index++, (uint32)GetInstanceId());
14808 stmt->SetData(index++, (uint8(dd) | uint8(rd) << 4));
14809 stmt->SetData(index++, finiteAlways(GetPositionX()));
14810 stmt->SetData(index++, finiteAlways(GetPositionY()));
14811 stmt->SetData(index++, finiteAlways(GetPositionZ()));
14812 stmt->SetData(index++, finiteAlways(GetOrientation()));
14813 }
14814 else
14815 {
14816 stmt->SetData(index++, (uint16)GetTeleportDest().GetMapId());
14817 stmt->SetData(index++, (uint32)0);
14818 stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
14819 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionX()));
14820 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionY()));
14821 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionZ()));
14822 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetOrientation()));
14823 }
14824
14825 stmt->SetData(index++, finiteAlways(GetTransOffsetX()));
14826 stmt->SetData(index++, finiteAlways(GetTransOffsetY()));
14827 stmt->SetData(index++, finiteAlways(GetTransOffsetZ()));
14828 stmt->SetData(index++, finiteAlways(GetTransOffsetO()));
14829
14830 int32 lowGuidOrSpawnId = 0;
14831 if (Transport* transport = GetTransport())
14832 {
14833 if (transport->IsMotionTransport())
14834 lowGuidOrSpawnId = static_cast<int32>(transport->GetGUID().GetCounter());
14835 else if (transport->IsStaticTransport())
14836 lowGuidOrSpawnId = -static_cast<int32>(transport->GetSpawnId());
14837 }
14838 stmt->SetData(index++, lowGuidOrSpawnId);
14839
14840 std::ostringstream ss;
14841 ss << m_taxi;
14842 stmt->SetData(index++, ss.str());
14843 stmt->SetData(index++, m_cinematic);
14844 stmt->SetData(index++, m_Played_time[PLAYED_TIME_TOTAL]);
14845 stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
14846 stmt->SetData(index++, finiteAlways(_restBonus));
14847 stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
14848 stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
14849 //save, far from tavern/city
14850 //save, but in tavern/city
14851 stmt->SetData(index++, m_resetTalentsCost);
14852 stmt->SetData(index++, uint32(m_resetTalentsTime));
14853 stmt->SetData(index++, (uint16)m_ExtraFlags);
14854 stmt->SetData(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
14855 stmt->SetData(index++, (uint16)m_atLoginFlags);
14856 stmt->SetData(index++, GetZoneId());
14857 stmt->SetData(index++, uint32(m_deathExpireTime));
14858
14859 ss.str("");
14861
14862 stmt->SetData(index++, ss.str());
14863 stmt->SetData(index++, GetArenaPoints());
14864 stmt->SetData(index++, GetHonorPoints());
14868 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
14869 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
14873 stmt->SetData(index++, GetDrunkValue());
14874 stmt->SetData(index++, GetHealth());
14875
14876 for (uint32 i = 0; i < MAX_POWERS; ++i)
14877 stmt->SetData(index++, GetPower(Powers(i)));
14878
14879 stmt->SetData(index++, GetSession()->GetLatency());
14880
14881 stmt->SetData(index++, m_specsCount);
14882 stmt->SetData(index++, m_activeSpec);
14883
14884 ss.str("");
14885 for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
14886 ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
14887 stmt->SetData(index++, ss.str());
14888
14889 ss.str("");
14890 // cache equipment...
14891 for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
14893
14894 // ...and bags for enum opcode
14896 {
14897 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
14898 ss << item->GetEntry();
14899 else
14900 ss << '0';
14901 ss << " 0 ";
14902 }
14903
14904 stmt->SetData(index++, ss.str());
14905 stmt->SetData(index++, GetUInt32Value(PLAYER_AMMO_ID));
14906
14907 ss.str("");
14908 for (uint32 i = 0; i < KNOWN_TITLES_SIZE * 2; ++i)
14910
14911 stmt->SetData(index++, ss.str());
14912 stmt->SetData(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
14913 stmt->SetData(index++, m_grantableLevels);
14914 stmt->SetData(index++, _innTriggerId);
14915 stmt->SetData(index++, m_extraBonusTalentCount);
14916
14917 stmt->SetData(index++, IsInWorld() && !GetSession()->PlayerLogout() ? 1 : 0);
14918 // Index
14919 stmt->SetData(index++, GetGUID().GetCounter());
14920 }
14921
14922 trans->Append(stmt);
14923}
@ CHAR_INS_CHARACTER
Definition CharacterDatabase.h:273
@ CHAR_UPD_CHARACTER
Definition CharacterDatabase.h:274
Difficulty
Definition DBCEnums.h:266
#define KNOWN_TITLES_SIZE
Definition Player.h:559
@ PLAYER_FLAGS_RESTING
Definition Player.h:485
@ INVENTORY_SLOT_BAG_START
Definition Player.h:706
#define PLAYER_EXPLORED_ZONES_SIZE
Definition Player.h:72
Powers
Definition SharedDefines.h:268
@ PLAYER_FIELD_TODAY_CONTRIBUTION
Definition UpdateFields.h:375
@ PLAYER_BYTES_3
Definition UpdateFields.h:183
@ PLAYER_XP
Definition UpdateFields.h:339
@ PLAYER_CHOSEN_TITLE
Definition UpdateFields.h:324
@ PLAYER_EXPLORED_ZONES_1
Definition UpdateFields.h:357
@ PLAYER_FIELD_KNOWN_CURRENCIES
Definition UpdateFields.h:338
@ PLAYER_BYTES_2
Definition UpdateFields.h:182
@ PLAYER__FIELD_KNOWN_TITLES
Definition UpdateFields.h:335
@ PLAYER_BYTES
Definition UpdateFields.h:181
@ PLAYER_FIELD_KILLS
Definition UpdateFields.h:374
@ PLAYER_FIELD_YESTERDAY_CONTRIBUTION
Definition UpdateFields.h:376
@ PLAYER_FIELD_WATCHED_FACTION_INDEX
Definition UpdateFields.h:379
@ PLAYER_VISIBLE_ITEM_1_ENTRYID
Definition UpdateFields.h:286
@ PLAYER_FIELD_LIFETIME_HONORABLE_KILLS
Definition UpdateFields.h:377
@ PLAYER_FIELD_BYTES
Definition UpdateFields.h:368
Definition Map.h:158
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:312
uint16 GetUInt16Value(uint16 index, uint8 offset) const
Definition Object.cpp:319
uint64 GetUInt64Value(uint16 index) const
Definition Object.cpp:300
std::string SaveTaxiDestinationsToString()
Definition PlayerTaxi.cpp:193
Difficulty GetRaidDifficulty() const
Definition Player.h:1935
WorldLocation & GetTeleportDest()
Definition Player.h:2107
uint32 GetArenaPoints() const
Definition Player.h:2171
uint8 GetDrunkValue() const
Definition Player.h:2189
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:441
uint32 GetHonorPoints() const
Definition Player.h:2170
PlayerFlags GetPlayerFlags() const
Definition Player.h:1126
uint32 GetMoney() const
Definition Player.h:1621
PlayerTaxi m_taxi
Definition Player.h:1162
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:1127
Difficulty GetDungeonDifficulty() const
Definition Player.h:1934
bool IsBeingTeleported() const
Definition Player.h:2108
Definition Transport.h:30
uint32 GetHealth() const
Definition Unit.h:1031
uint32 GetPower(Powers power) const
Definition Unit.h:1058
float GetTransOffsetX() const
Definition Object.h:670
uint32 GetInstanceId() const
Definition Object.h:499
float GetTransOffsetY() const
Definition Object.h:671
float GetTransOffsetZ() const
Definition Object.h:672
Transport * GetTransport() const
Definition Object.h:669
float GetTransOffsetO() const
Definition Object.h:673
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References _innTriggerId, _restBonus, CHAR_INS_CHARACTER, CHAR_UPD_CHARACTER, CharacterDatabase, EQUIPMENT_SLOT_END, WorldObject::FindMap(), GetArenaPoints(), Object::GetByteValue(), Unit::getClass(), ObjectGuid::GetCounter(), GetDrunkValue(), GetDungeonDifficulty(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetHealth(), GetHonorPoints(), WorldObject::GetInstanceId(), GetItemByPos(), WorldSession::GetLatency(), Unit::GetLevel(), WorldLocation::GetMapId(), GetMoney(), WorldObject::GetName(), Position::GetOrientation(), GetPlayerFlags(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetPower(), Unit::getRace(), GetRaidDifficulty(), GetSession(), GetTeleportDest(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), Object::GetUInt16Value(), Object::GetUInt32Value(), Object::GetUInt64Value(), WorldObject::GetZoneId(), HasPlayerFlag(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, IsBeingTeleported(), Object::IsInWorld(), KNOWN_TITLES_SIZE, m_activeSpec, m_atLoginFlags, m_cinematic, m_deathExpireTime, m_extraBonusTalentCount, m_ExtraFlags, m_grantableLevels, m_petStable, m_Played_time, m_resetTalentsCost, m_resetTalentsTime, m_specsCount, m_taxi, MAX_POWERS, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER__FIELD_KNOWN_TITLES, PLAYER_AMMO_ID, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, PLAYER_FIELD_BYTES, PLAYER_FIELD_KILLS, PLAYER_FIELD_KNOWN_CURRENCIES, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_FLAGS_RESTING, PLAYER_VISIBLE_ITEM_1_ENTRYID, PLAYER_XP, WorldSession::PlayerLogout(), PlayerTaxi::SaveTaxiDestinationsToString(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveDailyQuestStatus()

void Player::_SaveDailyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7536{
7538 return;
7539
7540 m_DailyQuestChanged = false;
7541
7542 // save last daily quest time for all quests: we need only mostly reset time for reset check anyway
7543
7544 // we don't need transactions here.
7546 stmt->SetData(0, GetGUID().GetCounter());
7547 trans->Append(stmt);
7548 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
7549 {
7550 if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
7551 {
7552 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
7553 stmt->SetData(0, GetGUID().GetCounter());
7554 stmt->SetData(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx));
7556 trans->Append(stmt);
7557 }
7558 }
7559
7560 if (!m_DFQuests.empty())
7561 {
7562 for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr)
7563 {
7564 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
7565 stmt->SetData(0, GetGUID().GetCounter());
7566 stmt->SetData(1, (*itr));
7568 trans->Append(stmt);
7569 }
7570 }
7571}
@ CHAR_DEL_QUEST_STATUS_DAILY_CHAR
Definition CharacterDatabase.h:59
@ CHAR_INS_CHARACTER_DAILYQUESTSTATUS
Definition CharacterDatabase.h:74

References CHAR_DEL_QUEST_STATUS_DAILY_CHAR, CHAR_INS_CHARACTER_DAILYQUESTSTATUS, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), Object::GetUInt32Value(), m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveEntryPoint()

void Player::_SaveEntryPoint ( CharacterDatabaseTransaction  trans)
protected
14567{
14568 // xinef: dont save joinpos with invalid mapid
14569 MapEntry const* mEntry = sMapStore.LookupEntry(m_entryPointData.joinPos.GetMapId());
14570 if (!mEntry)
14571 return;
14572
14574 stmt->SetData(0, GetGUID().GetCounter());
14575 trans->Append(stmt);
14576
14577 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_ENTRY_POINT);
14578 stmt->SetData(0, GetGUID().GetCounter());
14584 stmt->SetData(6, m_entryPointData.taxiPath[0]);
14585 stmt->SetData(7, m_entryPointData.taxiPath[1]);
14587 trans->Append(stmt);
14588}
@ CHAR_INS_PLAYER_ENTRY_POINT
Definition CharacterDatabase.h:239
@ CHAR_DEL_PLAYER_ENTRY_POINT
Definition CharacterDatabase.h:240

References CHAR_DEL_PLAYER_ENTRY_POINT, CHAR_INS_PLAYER_ENTRY_POINT, CharacterDatabase, Object::GetGUID(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), EntryPointData::joinPos, m_entryPointData, EntryPointData::mountSpell, PreparedStatementBase::SetData(), sMapStore, and EntryPointData::taxiPath.

Referenced by SaveToDB().

◆ _SaveEquipmentSets()

void Player::_SaveEquipmentSets ( CharacterDatabaseTransaction  trans)
protected
14516{
14517 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end();)
14518 {
14519 uint32 index = itr->first;
14520 EquipmentSet& eqset = itr->second;
14521 CharacterDatabasePreparedStatement* stmt = nullptr;
14522 uint8 j = 0;
14523 switch (eqset.state)
14524 {
14526 ++itr;
14527 break; // nothing do
14529 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
14530 stmt->SetData(j++, eqset.Name.c_str());
14531 stmt->SetData(j++, eqset.IconName.c_str());
14532 stmt->SetData(j++, eqset.IgnoreMask);
14533 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14534 stmt->SetData(j++, eqset.Items[i].GetCounter());
14535 stmt->SetData(j++, GetGUID().GetCounter());
14536 stmt->SetData(j++, eqset.Guid);
14537 stmt->SetData(j, index);
14538 trans->Append(stmt);
14540 ++itr;
14541 break;
14542 case EQUIPMENT_SET_NEW:
14543 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_EQUIP_SET);
14544 stmt->SetData(j++, GetGUID().GetCounter());
14545 stmt->SetData(j++, eqset.Guid);
14546 stmt->SetData(j++, index);
14547 stmt->SetData(j++, eqset.Name.c_str());
14548 stmt->SetData(j++, eqset.IconName.c_str());
14549 stmt->SetData(j++, eqset.IgnoreMask);
14550 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14551 stmt->SetData(j++, eqset.Items[i].GetCounter());
14552 trans->Append(stmt);
14554 ++itr;
14555 break;
14557 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EQUIP_SET);
14558 stmt->SetData(0, eqset.Guid);
14559 trans->Append(stmt);
14560 m_EquipmentSets.erase(itr++);
14561 break;
14562 }
14563 }
14564}
@ CHAR_UPD_EQUIP_SET
Definition CharacterDatabase.h:192
@ CHAR_INS_EQUIP_SET
Definition CharacterDatabase.h:193
@ CHAR_DEL_EQUIP_SET
Definition CharacterDatabase.h:194
@ EQUIPMENT_SET_CHANGED
Definition Player.h:750
@ EQUIPMENT_SET_DELETED
Definition Player.h:752
@ EQUIPMENT_SET_NEW
Definition Player.h:751

References CHAR_DEL_EQUIP_SET, CHAR_INS_EQUIP_SET, CHAR_UPD_EQUIP_SET, CharacterDatabase, EQUIPMENT_SET_CHANGED, EQUIPMENT_SET_DELETED, EQUIPMENT_SET_NEW, EQUIPMENT_SET_UNCHANGED, EQUIPMENT_SLOT_END, ObjectGuid::GetCounter(), Object::GetGUID(), EquipmentSet::Guid, EquipmentSet::IconName, EquipmentSet::IgnoreMask, EquipmentSet::Items, m_EquipmentSets, EquipmentSet::Name, PreparedStatementBase::SetData(), and EquipmentSet::state.

Referenced by SaveToDB().

◆ _SaveGlyphs()

void Player::_SaveGlyphs ( CharacterDatabaseTransaction  trans)
protected
14949{
14950 if (!NeedToSaveGlyphs())
14951 return;
14952
14954 stmt->SetData(0, GetGUID().GetCounter());
14955 trans->Append(stmt);
14956
14957 for (uint8 spec = 0; spec < m_specsCount; ++spec)
14958 {
14959 uint8 index = 0;
14960
14961 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS);
14962 stmt->SetData(index++, GetGUID().GetCounter());
14963 stmt->SetData(index++, spec);
14964
14965 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
14966 stmt->SetData(index++, uint16(m_Glyphs[spec][i]));
14967
14968 trans->Append(stmt);
14969 }
14970
14971 SetNeedToSaveGlyphs(false);
14972}
@ CHAR_DEL_CHAR_GLYPHS
Definition CharacterDatabase.h:422
@ CHAR_INS_CHAR_GLYPHS
Definition CharacterDatabase.h:456
void SetNeedToSaveGlyphs(bool val)
Definition Player.h:2618
bool NeedToSaveGlyphs()
Definition Player.h:2617

References CHAR_DEL_CHAR_GLYPHS, CHAR_INS_CHAR_GLYPHS, CharacterDatabase, Object::GetGUID(), m_Glyphs, m_specsCount, MAX_GLYPH_SLOT_INDEX, NeedToSaveGlyphs(), PreparedStatementBase::SetData(), and SetNeedToSaveGlyphs().

Referenced by SaveToDB().

◆ _SaveInstanceTimeRestrictions()

void Player::_SaveInstanceTimeRestrictions ( CharacterDatabaseTransaction  trans)
protected
15839{
15840 if (_instanceResetTimes.empty())
15841 return;
15842
15844 stmt->SetData(0, GetSession()->GetAccountId());
15845 trans->Append(stmt);
15846
15847 for (InstanceTimeMap::const_iterator itr = _instanceResetTimes.begin(); itr != _instanceResetTimes.end(); ++itr)
15848 {
15849 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES);
15850 stmt->SetData(0, GetSession()->GetAccountId());
15851 stmt->SetData(1, itr->first);
15852 stmt->SetData(2, (int64)itr->second);
15853 trans->Append(stmt);
15854 }
15855}
@ CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES
Definition CharacterDatabase.h:133
@ CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES
Definition CharacterDatabase.h:134
std::int64_t int64
Definition Define.h:102
uint32 GetAccountId() const
Definition WorldSession.h:380

References _instanceResetTimes, CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES, CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES, CharacterDatabase, WorldSession::GetAccountId(), GetSession(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveInventory()

void Player::_SaveInventory ( CharacterDatabaseTransaction  trans)
protected
7256{
7257 CharacterDatabasePreparedStatement* stmt = nullptr;
7258 // force items in buyback slots to new state
7259 // and remove those that aren't already
7260 for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i)
7261 {
7262 Item* item = m_items[i];
7263 if (!item)
7264 continue;
7265
7266 if (item->GetState() == ITEM_NEW)
7267 {
7268 // Xinef: item is removed, remove loot from storage if any
7270 sLootItemStorage->RemoveStoredLoot(item->GetGUID());
7271 continue;
7272 }
7273
7274 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
7275 stmt->SetData(0, item->GetGUID().GetCounter());
7276 trans->Append(stmt);
7277
7278 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
7279 stmt->SetData(0, item->GetGUID().GetCounter());
7280 trans->Append(stmt);
7282
7283 // Xinef: item is removed, remove loot from storage if any
7285 sLootItemStorage->RemoveStoredLoot(item->GetGUID());
7286 }
7287
7288 // Updated played time for refundable items. We don't do this in Player::Update because there's simply no need for it,
7289 // the client auto counts down in real time after having received the initial played time on the first
7290 // SMSG_ITEM_REFUND_INFO_RESPONSE packet.
7291 // Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests.
7292 RefundableItemsSet::iterator i_next;
7293 for (RefundableItemsSet::iterator itr = m_refundableItems.begin(); itr != m_refundableItems.end(); itr = i_next)
7294 {
7295 // use copy iterator because itr may be invalid after operations in this loop
7296 i_next = itr;
7297 ++i_next;
7298
7299 Item* iPtr = GetItemByGuid((*itr));
7300 if (iPtr)
7301 {
7302 iPtr->UpdatePlayedTime(this);
7303 continue;
7304 }
7305 else
7306 {
7307 LOG_ERROR("entities.player", "Can't find item {} but is in refundable storage for player {} ! Removing.", (*itr).ToString(), GetGUID().ToString());
7308 m_refundableItems.erase(itr);
7309 }
7310 }
7311
7312 // update enchantment durations
7313 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
7314 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
7315
7316 // if no changes
7317 if (m_itemUpdateQueue.empty())
7318 return;
7319
7321 for (std::size_t i = 0; i < m_itemUpdateQueue.size(); ++i)
7322 {
7323 Item* item = m_itemUpdateQueue[i];
7324 if (!item)
7325 continue;
7326
7327 Bag* container = item->GetContainer();
7328 ObjectGuid::LowType bag_guid = container ? container->GetGUID().GetCounter() : 0;
7329
7330 if (item->GetState() != ITEM_REMOVED)
7331 {
7332 Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot());
7333 if (!test)
7334 {
7335 ObjectGuid::LowType bagTestGUID = 0;
7336 if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
7337 bagTestGUID = test2->GetGUID().GetCounter();
7338 LOG_ERROR("entities.player", "Player(GUID: {} Name: {})::_SaveInventory - the bag({}) and slot({}) values for the item {} (state {}) are incorrect, the player doesn't have an item at that position!",
7339 lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), (int32)item->GetState());
7340 // according to the test that was just performed nothing should be in this slot, delete
7341 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT);
7342 stmt->SetData(0, bagTestGUID);
7343 stmt->SetData(1, item->GetSlot());
7344 stmt->SetData(2, lowGuid);
7345 trans->Append(stmt);
7346
7347 RemoveTradeableItem(item); // pussywizard
7348 RemoveEnchantmentDurationsReferences(item); // pussywizard
7349 RemoveItemDurations(item); // pussywizard
7350
7351 // also THIS item should be somewhere else, cheat attempt
7352 item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue
7354 // don't skip, let the switch delete it
7355 continue;
7356 }
7357 else if (test != item)
7358 {
7359 LOG_ERROR("entities.player", "Player(GUID: {} Name: {})::_SaveInventory - the bag({}) and slot({}) values for the item ({}) are incorrect, the item ({}) is there instead!",
7360 lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), test->GetGUID().ToString());
7361 // save all changes to the item...
7362 if (item->GetState() != ITEM_NEW) // only for existing items, no dupes
7363 item->SaveToDB(trans);
7364 // ...but do not save position in invntory
7365 continue;
7366 }
7367 }
7368
7369 switch (item->GetState())
7370 {
7371 case ITEM_NEW:
7372 case ITEM_CHANGED:
7373 stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_INVENTORY_ITEM);
7374 stmt->SetData(0, lowGuid);
7375 stmt->SetData(1, bag_guid);
7376 stmt->SetData (2, item->GetSlot());
7377 stmt->SetData(3, item->GetGUID().GetCounter());
7378 trans->Append(stmt);
7379 break;
7380 case ITEM_REMOVED:
7381 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
7382 stmt->SetData(0, item->GetGUID().GetCounter());
7383 trans->Append(stmt);
7384 case ITEM_UNCHANGED:
7385 break;
7386 }
7387
7388 item->SaveToDB(trans); // item have unchanged inventory record and can be save standalone
7389 }
7390 m_itemUpdateQueue.clear();
7391}
@ CHAR_DEL_ITEM_INSTANCE
Definition CharacterDatabase.h:127
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
Definition CharacterDatabase.h:435
@ CHAR_REP_INVENTORY_ITEM
Definition CharacterDatabase.h:123
@ CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT
Definition CharacterDatabase.h:436
@ ITEM_FLAG_HAS_LOOT
Definition ItemTemplate.h:149
@ ITEM_CHANGED
Definition Item.h:210
@ ITEM_NEW
Definition Item.h:211
#define sLootItemStorage
Definition LootItemStorage.h:73
@ BUYBACK_SLOT_END
Definition Player.h:732
uint8 GetSlot() const
Definition Item.h:281
Bag * GetContainer()
Definition Item.h:282
ItemUpdateState GetState() const
Definition Item.h:324
void UpdatePlayedTime(Player *owner)
Definition Item.cpp:1218
uint8 GetBagSlot() const
Definition Item.cpp:784
std::vector< Item * > m_itemUpdateQueue
Definition Player.h:2809
void DeleteRefundReference(ObjectGuid itemGUID)
Definition Player.cpp:15480
void RemoveTradeableItem(Item *item)
Definition PlayerStorage.cpp:4139
EnchantDurationList m_enchantDuration
Definition Player.h:2854
void RemoveItemDurations(Item *item)
Definition Player.cpp:12411
void RemoveEnchantmentDurationsReferences(Item *item)
Definition PlayerStorage.cpp:4214
RefundableItemsSet m_refundableItems
Definition Player.h:2957
Item * GetItemByGuid(ObjectGuid guid) const
Definition PlayerStorage.cpp:407
bool HasFlag(ItemFlags flag) const
Definition ItemTemplate.h:826

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT, CHAR_DEL_CHAR_INVENTORY_BY_ITEM, CHAR_DEL_ITEM_INSTANCE, CHAR_REP_INVENTORY_ITEM, CharacterDatabase, DeleteRefundReference(), Item::FSetState(), Item::GetBagSlot(), Item::GetContainer(), ObjectGuid::GetCounter(), Object::GetGUID(), Object::GetGUID(), GetItemByGuid(), GetItemByPos(), WorldObject::GetName(), Item::GetSlot(), Item::GetState(), Item::GetTemplate(), ItemTemplate::HasFlag(), INVENTORY_SLOT_BAG_0, ITEM_CHANGED, ITEM_FLAG_HAS_LOOT, ITEM_NEW, ITEM_REMOVED, ITEM_UNCHANGED, LOG_ERROR, m_enchantDuration, m_items, m_itemUpdateQueue, m_refundableItems, RemoveEnchantmentDurationsReferences(), RemoveItemDurations(), RemoveTradeableItem(), Item::SaveToDB(), PreparedStatementBase::SetData(), sLootItemStorage, ObjectGuid::ToString(), Position::ToString(), and Item::UpdatePlayedTime().

Referenced by SaveInventoryAndGoldToDB(), and SaveToDB().

◆ _SaveMail()

void Player::_SaveMail ( CharacterDatabaseTransaction  trans)
protected
7394{
7395 if (!GetMailSize() || !m_mailsUpdated)
7396 {
7397 return;
7398 }
7399
7400 CharacterDatabasePreparedStatement* stmt = nullptr;
7401
7402 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
7403 {
7404 Mail* m = (*itr);
7405 if (m->state == MAIL_STATE_CHANGED)
7406 {
7407 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL);
7408 stmt->SetData(0, uint8(m->HasItems() ? 1 : 0));
7409 stmt->SetData(1, uint32(m->expire_time));
7410 stmt->SetData(2, uint32(m->deliver_time));
7411 stmt->SetData(3, m->money);
7412 stmt->SetData(4, m->COD);
7413 stmt->SetData(5, uint8(m->checked));
7414 stmt->SetData(6, m->messageID);
7415
7416 trans->Append(stmt);
7417
7418 if (!m->removedItems.empty())
7419 {
7420 for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
7421 {
7422 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
7423 stmt->SetData(0, *itr2);
7424 trans->Append(stmt);
7425 }
7426 m->removedItems.clear();
7427 }
7429 }
7430 else if (m->state == MAIL_STATE_DELETED)
7431 {
7432 if (m->HasItems())
7433 {
7434 for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
7435 {
7436 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
7437 stmt->SetData(0, itr2->item_guid);
7438 trans->Append(stmt);
7439 }
7440 }
7441 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
7442 stmt->SetData(0, m->messageID);
7443 trans->Append(stmt);
7444
7445 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
7446 stmt->SetData(0, m->messageID);
7447 trans->Append(stmt);
7448 }
7449 }
7450
7451 //deallocate deleted mails...
7452 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end();)
7453 {
7454 if ((*itr)->state == MAIL_STATE_DELETED)
7455 {
7456 Mail* m = *itr;
7457 m_mail.erase(itr);
7458 delete m;
7459 itr = m_mail.begin();
7460 }
7461 else
7462 ++itr;
7463 }
7464
7465 m_mailsUpdated = false;
7466}
@ CHAR_UPD_MAIL
Definition CharacterDatabase.h:437
@ CHAR_DEL_MAIL_BY_ID
Definition CharacterDatabase.h:110
@ CHAR_DEL_MAIL_ITEM_BY_ID
Definition CharacterDatabase.h:382
@ MAIL_STATE_DELETED
Definition Mail.h:70
@ MAIL_STATE_CHANGED
Definition Mail.h:69
uint32 GetMailSize()
Definition Player.h:1662
bool HasItems() const
Definition Mail.h:206
std::vector< uint32 > removedItems
Definition Mail.h:177
std::vector< MailItemInfo > items
Definition Mail.h:176

References CHAR_DEL_ITEM_INSTANCE, CHAR_DEL_MAIL_BY_ID, CHAR_DEL_MAIL_ITEM, CHAR_DEL_MAIL_ITEM_BY_ID, CHAR_UPD_MAIL, CharacterDatabase, Mail::checked, Mail::COD, Mail::deliver_time, Mail::expire_time, GetMailSize(), Mail::HasItems(), Mail::items, m_mail, m_mailsUpdated, MAIL_STATE_CHANGED, MAIL_STATE_DELETED, MAIL_STATE_UNCHANGED, Mail::messageID, Mail::money, Mail::removedItems, PreparedStatementBase::SetData(), and Mail::state.

Referenced by WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), and SaveToDB().

◆ _SaveMonthlyQuestStatus()

void Player::_SaveMonthlyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7631{
7632 if (!m_MonthlyQuestChanged || m_monthlyquests.empty())
7633 return;
7634
7635 // we don't need transactions here.
7637 stmt->SetData(0, GetGUID().GetCounter());
7638 trans->Append(stmt);
7639
7640 for (QuestSet::const_iterator iter = m_monthlyquests.begin(); iter != m_monthlyquests.end(); ++iter)
7641 {
7642 uint32 quest_id = *iter;
7643 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS);
7644 stmt->SetData(0, GetGUID().GetCounter());
7645 stmt->SetData(1, quest_id);
7646 trans->Append(stmt);
7647 }
7648
7649 m_MonthlyQuestChanged = false;
7650}
@ CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS
Definition CharacterDatabase.h:76
@ CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR
Definition CharacterDatabase.h:61

References CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR, CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_MonthlyQuestChanged, m_monthlyquests, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SavePlayerSettings()

void Player::_SavePlayerSettings ( CharacterDatabaseTransaction  trans)
protected
75{
76 if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
77 return;
78
79 for (auto const& [source, settings] : m_charSettingsMap)
80 {
81 if (settings.empty())
82 continue;
83
84 std::ostringstream data;
85 data << settings[0].value;
86
87 for (size_t i = 1; i < settings.size(); ++i)
88 data << ' ' << settings[i].value;
89
91 stmt->SetData(0, GetGUID().GetCounter());
92 stmt->SetData(1, source);
93 stmt->SetData(2, data.str());
94 trans->Append(stmt);
95 }
96}
@ CHAR_REP_CHAR_SETTINGS
Definition CharacterDatabase.h:523

References CHAR_REP_CHAR_SETTINGS, CharacterDatabase, CONFIG_PLAYER_SETTINGS_ENABLED, ObjectGuid::GetCounter(), Object::GetGUID(), m_charSettingsMap, PreparedStatementBase::SetData(), and sWorld.

Referenced by SaveToDB().

◆ _SaveQuestStatus()

void Player::_SaveQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7469{
7470 bool isTransaction = static_cast<bool>(trans);
7471 if (!isTransaction)
7472 trans = CharacterDatabase.BeginTransaction();
7473
7474 QuestStatusSaveMap::iterator saveItr;
7475 QuestStatusMap::iterator statusItr;
7476 CharacterDatabasePreparedStatement* stmt = nullptr;
7477
7478 bool keepAbandoned = !(sWorld->GetCleaningFlags() & CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS);
7479
7480 for (saveItr = m_QuestStatusSave.begin(); saveItr != m_QuestStatusSave.end(); ++saveItr)
7481 {
7482 if (saveItr->second)
7483 {
7484 statusItr = m_QuestStatus.find(saveItr->first);
7485 if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE))
7486 {
7487 uint8 index = 0;
7488 stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_QUESTSTATUS);
7489
7490 stmt->SetData(index++, GetGUID().GetCounter());
7491 stmt->SetData(index++, statusItr->first);
7492 stmt->SetData(index++, uint8(statusItr->second.Status));
7493 stmt->SetData(index++, statusItr->second.Explored);
7494 stmt->SetData(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS + GameTime::GetGameTime().count()));
7495
7496 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
7497 stmt->SetData(index++, statusItr->second.CreatureOrGOCount[i]);
7498
7499 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
7500 stmt->SetData(index++, statusItr->second.ItemCount[i]);
7501
7502 stmt->SetData(index, statusItr->second.PlayerCount);
7503 trans->Append(stmt);
7504 }
7505 }
7506 else
7507 {
7508 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST);
7509 stmt->SetData(0, GetGUID().GetCounter());
7510 stmt->SetData(1, saveItr->first);
7511 trans->Append(stmt);
7512 }
7513 }
7514
7515 m_QuestStatusSave.clear();
7516
7517 for (saveItr = m_RewardedQuestsSave.begin(); saveItr != m_RewardedQuestsSave.end(); ++saveItr)
7518 {
7519 if (saveItr->second)
7520 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED);
7521 else // xinef: what the is this? quest can be removed by spelleffect if (!keepAbandoned)
7523
7524 stmt->SetData(0, GetGUID().GetCounter());
7525 stmt->SetData(1, saveItr->first);
7526 trans->Append(stmt);
7527 }
7528
7529 m_RewardedQuestsSave.clear();
7530
7531 if (!isTransaction)
7532 CharacterDatabase.CommitTransaction(trans);
7533}
@ CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST
Definition CharacterDatabase.h:441
@ CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST
Definition CharacterDatabase.h:439
@ CHAR_REP_CHAR_QUESTSTATUS
Definition CharacterDatabase.h:438
@ CHAR_INS_CHAR_QUESTSTATUS_REWARDED
Definition CharacterDatabase.h:440
QuestStatusSaveMap m_QuestStatusSave
Definition Player.h:2815
QuestStatusSaveMap m_RewardedQuestsSave
Definition Player.h:2818
@ CLEANING_FLAG_QUESTSTATUS
Definition CharacterDatabaseCleaner.h:31

References CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, CHAR_INS_CHAR_QUESTSTATUS_REWARDED, CHAR_REP_CHAR_QUESTSTATUS, CharacterDatabase, CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS, ObjectGuid::GetCounter(), GameTime::GetGameTime(), Object::GetGUID(), IN_MILLISECONDS, m_QuestStatus, m_QuestStatusSave, m_RewardedQuestsSave, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_STATUS_NONE, PreparedStatementBase::SetData(), and sWorld.

Referenced by SaveToDB().

◆ _SaveSeasonalQuestStatus()

void Player::_SaveSeasonalQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7597{
7599 {
7600 return;
7601 }
7602
7603 // we don't need transactions here.
7605 stmt->SetData(0, GetGUID().GetCounter());
7606 trans->Append(stmt);
7607
7608 m_SeasonalQuestChanged = false;
7609
7610 if (m_seasonalquests.empty())
7611 {
7612 return;
7613 }
7614
7615 for (SeasonalEventQuestMap::const_iterator iter = m_seasonalquests.begin(); iter != m_seasonalquests.end(); ++iter)
7616 {
7617 uint16 eventId = iter->first;
7618
7619 for (SeasonalQuestSet::const_iterator itr = iter->second.begin(); itr != iter->second.end(); ++itr)
7620 {
7621 uint32 questId = *itr;
7622
7623 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS);
7624 stmt->SetArguments(GetGUID().GetCounter(), questId, eventId);
7625 trans->Append(stmt);
7626 }
7627 }
7628}
@ CHAR_INS_CHARACTER_SEASONALQUESTSTATUS
Definition CharacterDatabase.h:77
@ CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR
Definition CharacterDatabase.h:62
void SetArguments(Args &&... args)
Definition PreparedStatement.h:118

References CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR, CHAR_INS_CHARACTER_SEASONALQUESTSTATUS, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_SeasonalQuestChanged, m_seasonalquests, PreparedStatementBase::SetArguments(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveSkills()

void Player::_SaveSkills ( CharacterDatabaseTransaction  trans)
7653{
7654 CharacterDatabasePreparedStatement* stmt = nullptr;
7655 // we don't need transactions here.
7656 for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();)
7657 {
7658 if (itr->second.uState == SKILL_UNCHANGED)
7659 {
7660 ++itr;
7661 continue;
7662 }
7663
7664 if (itr->second.uState == SKILL_DELETED)
7665 {
7666 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL);
7667 stmt->SetData(0, GetGUID().GetCounter());
7668 stmt->SetData(1, itr->first);
7669 trans->Append(stmt);
7670
7671 mSkillStatus.erase(itr++);
7672 continue;
7673 }
7674
7675 uint32 valueData = GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos));
7676 uint16 value = SKILL_VALUE(valueData);
7677 uint16 max = SKILL_MAX(valueData);
7678
7679 switch (itr->second.uState)
7680 {
7681 case SKILL_NEW:
7682 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILLS);
7683 stmt->SetData(0, GetGUID().GetCounter());
7684 stmt->SetData(1, uint16(itr->first));
7685 stmt->SetData(2, value);
7686 stmt->SetData(3, max);
7687 trans->Append(stmt);
7688
7689 break;
7690 case SKILL_CHANGED:
7691 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_SKILLS);
7692 stmt->SetData(0, value);
7693 stmt->SetData(1, max);
7694 stmt->SetData(2, GetGUID().GetCounter());
7695 stmt->SetData(3, uint16(itr->first));
7696 trans->Append(stmt);
7697
7698 break;
7699 default:
7700 break;
7701 }
7702 itr->second.uState = SKILL_UNCHANGED;
7703
7704 ++itr;
7705 }
7706}
@ CHAR_INS_CHAR_SKILLS
Definition CharacterDatabase.h:446
@ CHAR_UDP_CHAR_SKILLS
Definition CharacterDatabase.h:447
@ CHAR_DEL_CHAR_SKILL_BY_SKILL
Definition CharacterDatabase.h:445
#define SKILL_MAX(x)
Definition Player.h:83
#define SKILL_VALUE(x)
Definition Player.h:82
@ SKILL_CHANGED
Definition Player.h:647
@ SKILL_NEW
Definition Player.h:648

References CHAR_DEL_CHAR_SKILL_BY_SKILL, CHAR_INS_CHAR_SKILLS, CHAR_UDP_CHAR_SKILLS, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_VALUE_INDEX, PreparedStatementBase::SetData(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_UNCHANGED, and SKILL_VALUE.

Referenced by SaveToDB().

◆ _SaveSpellCooldowns()

void Player::_SaveSpellCooldowns ( CharacterDatabaseTransaction  trans,
bool  logout 
)
3649{
3651 stmt->SetData(0, GetGUID().GetCounter());
3652 trans->Append(stmt);
3653
3654 time_t curTime = GameTime::GetGameTime().count();
3655 uint32 curMSTime = GameTime::GetGameTimeMS().count();
3656 uint32 infTime = curMSTime + infinityCooldownDelayCheck;
3657
3658 bool first_round = true;
3659 std::ostringstream ss;
3660
3661 // remove outdated and save active
3662 for (SpellCooldowns::iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end();)
3663 {
3664 // Xinef: dummy cooldown for procs
3665 if (itr->first == uint32(-1))
3666 {
3667 ++itr;
3668 continue;
3669 }
3670
3671 if (itr->second.end <= curMSTime + 1000)
3672 m_spellCooldowns.erase(itr++);
3673 else if (itr->second.end <= infTime && (logout || itr->second.end > (curMSTime + 5 * MINUTE * IN_MILLISECONDS))) // not save locked cooldowns, it will be reset or set at reload
3674 {
3675 if (first_round)
3676 {
3677 ss << "INSERT INTO character_spell_cooldown (guid, spell, category, item, time, needSend) VALUES ";
3678 first_round = false;
3679 }
3680 // next new/changed record prefix
3681 else
3682 ss << ',';
3683
3684 uint64 cooldown = uint64(((itr->second.end - curMSTime) / IN_MILLISECONDS) + curTime);
3685 ss << '(' << GetGUID().GetCounter() << ',' << itr->first << ',' << itr->second.category << "," << itr->second.itemid << ',' << cooldown << ',' << (itr->second.needSendToClient ? '1' : '0') << ')';
3686 ++itr;
3687 }
3688 else
3689 ++itr;
3690 }
3691 // if something changed execute
3692 if (!first_round)
3693 trans->Append(ss.str().c_str());
3694}
@ CHAR_DEL_CHAR_SPELL_COOLDOWN
Definition CharacterDatabase.h:406
static constexpr uint32 infinityCooldownDelayCheck
Definition Unit.h:48

References CHAR_DEL_CHAR_SPELL_COOLDOWN, CharacterDatabase, ObjectGuid::GetCounter(), GameTime::GetGameTime(), GameTime::GetGameTimeMS(), Object::GetGUID(), IN_MILLISECONDS, infinityCooldownDelayCheck, m_spellCooldowns, MINUTE, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveSpells()

void Player::_SaveSpells ( CharacterDatabaseTransaction  trans)
protected
7709{
7710 CharacterDatabasePreparedStatement* stmt = nullptr;
7711
7712 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();)
7713 {
7714 // xinef: skip temporary spells
7715 if (itr->second->State == PLAYERSPELL_TEMPORARY)
7716 {
7717 ++itr;
7718 continue;
7719 }
7720
7721 // xinef: Delete statement for removed / updated spell
7722 if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED)
7723 {
7724 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
7725 stmt->SetData(0, GetGUID().GetCounter());
7726 stmt->SetData(1, itr->first);
7727 trans->Append(stmt);
7728 }
7729
7730 // xinef: insert statement for new / updated spell
7731 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED)
7732 {
7733 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL);
7734 stmt->SetData(0, GetGUID().GetCounter());
7735 stmt->SetData(1, itr->first);
7736 stmt->SetData(2, itr->second->specMask);
7737 trans->Append(stmt);
7738 }
7739
7740 if (itr->second->State == PLAYERSPELL_REMOVED)
7741 {
7742 delete itr->second;
7743 m_spells.erase(itr++);
7744 }
7745 else
7746 {
7747 itr->second->State = PLAYERSPELL_UNCHANGED;
7748 ++itr;
7749 }
7750 }
7751}
@ CHAR_INS_CHAR_SPELL
Definition CharacterDatabase.h:448
@ CHAR_DEL_CHAR_SPELL_BY_SPELL
Definition CharacterDatabase.h:399

References CHAR_DEL_CHAR_SPELL_BY_SPELL, CHAR_INS_CHAR_SPELL, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_spells, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveStats()

void Player::_SaveStats ( CharacterDatabaseTransaction  trans)
protected
7756{
7757 // check if stat saving is enabled and if char level is high enough
7758 if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || GetLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE))
7759 return;
7760
7761 CharacterDatabasePreparedStatement* stmt = nullptr;
7762
7763 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS);
7764 stmt->SetData(0, GetGUID().GetCounter());
7765 trans->Append(stmt);
7766
7767 uint8 index = 0;
7768
7769 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_STATS);
7770 stmt->SetData(index++, GetGUID().GetCounter());
7771 stmt->SetData(index++, GetMaxHealth());
7772
7773 for (uint8 i = 0; i < MAX_POWERS; ++i)
7774 stmt->SetData(index++, GetMaxPower(Powers(i)));
7775
7776 for (uint8 i = 0; i < MAX_STATS; ++i)
7777 stmt->SetData(index++, GetStat(Stats(i)));
7778
7779 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
7780 stmt->SetData(index++, GetResistance(SpellSchools(i)));
7781
7790 stmt->SetData(index++, GetBaseSpellPowerBonus());
7792
7793 trans->Append(stmt);
7794}
@ CHAR_DEL_CHAR_STATS
Definition CharacterDatabase.h:449
@ CHAR_INS_CHAR_STATS
Definition CharacterDatabase.h:450
#define MAX_STATS
Definition SharedDefines.h:265
SpellSchools
Definition SharedDefines.h:282
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:292
Stats
Definition SharedDefines.h:257
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition UpdateFields.h:351
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition UpdateFields.h:354
@ PLAYER_FIELD_COMBAT_RATING_1
Definition UpdateFields.h:380
@ PLAYER_PARRY_PERCENTAGE
Definition UpdateFields.h:348
@ PLAYER_BLOCK_PERCENTAGE
Definition UpdateFields.h:346
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition UpdateFields.h:165
@ PLAYER_DODGE_PERCENTAGE
Definition UpdateFields.h:347
@ UNIT_FIELD_ATTACK_POWER
Definition UpdateFields.h:162
@ CONFIG_MIN_LEVEL_STAT_SAVE
Definition WorldConfig.h:304
float GetFloatValue(uint16 index) const
Definition Object.cpp:306
uint32 GetBaseSpellPowerBonus()
Definition Player.h:1986
uint32 GetResistance(SpellSchoolMask mask) const
Definition Unit.cpp:20172
uint32 GetMaxHealth() const
Definition Unit.h:1032
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1059
float GetStat(Stats stat) const
Definition Unit.h:997

References CHAR_DEL_CHAR_STATS, CHAR_INS_CHAR_STATS, CharacterDatabase, CONFIG_MIN_LEVEL_STAT_SAVE, CR_CRIT_TAKEN_SPELL, GetBaseSpellPowerBonus(), Object::GetFloatValue(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetResistance(), Unit::GetStat(), Object::GetUInt32Value(), MAX_POWERS, MAX_SPELL_SCHOOL, MAX_STATS, PLAYER_BLOCK_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_DODGE_PERCENTAGE, PLAYER_FIELD_COMBAT_RATING_1, PLAYER_PARRY_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, PreparedStatementBase::SetData(), sWorld, UNIT_FIELD_ATTACK_POWER, and UNIT_FIELD_RANGED_ATTACK_POWER.

Referenced by SaveToDB().

◆ _SaveTalents()

void Player::_SaveTalents ( CharacterDatabaseTransaction  trans)
protected
14993{
14994 CharacterDatabasePreparedStatement* stmt = nullptr;
14995
14996 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end();)
14997 {
14998 // xinef: skip temporary spells
14999 if (itr->second->State == PLAYERSPELL_TEMPORARY)
15000 {
15001 ++itr;
15002 continue;
15003 }
15004
15005 // xinef: delete statement for removed / updated talent
15006 if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED)
15007 {
15008 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL);
15009 stmt->SetData(0, GetGUID().GetCounter());
15010 stmt->SetData(1, itr->first);
15011 trans->Append(stmt);
15012 }
15013
15014 // xinef: insert statement for new / updated spell
15015 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED)
15016 {
15017 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT);
15018 stmt->SetData(0, GetGUID().GetCounter());
15019 stmt->SetData(1, itr->first);
15020 stmt->SetData(2, itr->second->specMask);
15021 trans->Append(stmt);
15022 }
15023
15024 if (itr->second->State == PLAYERSPELL_REMOVED)
15025 {
15026 delete itr->second;
15027 m_talents.erase(itr++);
15028 }
15029 else
15030 {
15031 itr->second->State = PLAYERSPELL_UNCHANGED;
15032 ++itr;
15033 }
15034 }
15035}
@ CHAR_INS_CHAR_TALENT
Definition CharacterDatabase.h:458
@ CHAR_DEL_CHAR_TALENT_BY_SPELL
Definition CharacterDatabase.h:457

References CHAR_DEL_CHAR_TALENT_BY_SPELL, CHAR_INS_CHAR_TALENT, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_talents, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveWeeklyQuestStatus()

void Player::_SaveWeeklyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7574{
7575 if (!m_WeeklyQuestChanged || m_weeklyquests.empty())
7576 return;
7577
7578 // we don't need transactions here.
7580 stmt->SetData(0, GetGUID().GetCounter());
7581 trans->Append(stmt);
7582
7583 for (QuestSet::const_iterator iter = m_weeklyquests.begin(); iter != m_weeklyquests.end(); ++iter)
7584 {
7585 uint32 quest_id = *iter;
7586
7587 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS);
7588 stmt->SetData(0, GetGUID().GetCounter());
7589 stmt->SetData(1, quest_id);
7590 trans->Append(stmt);
7591 }
7592
7593 m_WeeklyQuestChanged = false;
7594}
@ CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR
Definition CharacterDatabase.h:60
@ CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS
Definition CharacterDatabase.h:75

References CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR, CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), m_WeeklyQuestChanged, m_weeklyquests, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _StoreItem()

Item * Player::_StoreItem ( uint16  pos,
Item pItem,
uint32  count,
bool  clone,
bool  update 
)
private
2610{
2611 if (!pItem)
2612 return nullptr;
2613
2614 uint8 bag = pos >> 8;
2615 uint8 slot = pos & 255;
2616
2617 LOG_DEBUG("entities.player.items", "STORAGE: StoreItem bag = {}, slot = {}, item = {}, count = {}, {}", bag, slot, pItem->GetEntry(), count, pItem->GetGUID().ToString());
2618
2619 Item* pItem2 = GetItemByPos(bag, slot);
2620
2621 if (!pItem2)
2622 {
2623 if (clone)
2624 pItem = pItem->CloneItem(count, this);
2625 else
2626 pItem->SetCount(count);
2627
2628 if (!pItem)
2629 return nullptr;
2630
2631 if (pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
2632 pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
2633 (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPPED && IsBagPos(pos)))
2634 pItem->SetBinding(true);
2635
2636 Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? nullptr : GetBagByPos(bag);
2637 if (!pBag)
2638 {
2639 m_items[slot] = pItem;
2640 SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
2643
2644 pItem->SetSlot(slot);
2645 pItem->SetContainer(nullptr);
2646
2647 // need update known currency
2649 AddKnownCurrency(pItem->GetEntry());
2650 }
2651 else
2652 pBag->StoreItem(slot, pItem, update);
2653
2654 if (IsInWorld() && update)
2655 {
2656 pItem->AddToWorld();
2657 pItem->SendUpdateToPlayer(this);
2658 }
2659
2660 pItem->SetState(ITEM_CHANGED, this);
2661 if (pBag)
2662 pBag->SetState(ITEM_CHANGED, this);
2663
2665 AddItemDurations(pItem);
2666
2667 return pItem;
2668 }
2669 else
2670 {
2671 if (pItem2->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
2672 pItem2->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
2673 (pItem2->GetTemplate()->Bonding == BIND_WHEN_EQUIPPED && IsBagPos(pos)))
2674 pItem2->SetBinding(true);
2675
2676 pItem2->SetCount(pItem2->GetCount() + count);
2677 if (IsInWorld() && update)
2678 pItem2->SendUpdateToPlayer(this);
2679
2680 if (!clone)
2681 {
2682 // delete item (it not in any slot currently)
2683 if (IsInWorld() && update)
2684 {
2685 pItem->RemoveFromWorld();
2686 pItem->DestroyForPlayer(this);
2687 }
2688
2690 RemoveItemDurations(pItem);
2691
2692 pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
2693 pItem->SetNotRefundable(this);
2694 pItem->ClearSoulboundTradeable(this);
2695 RemoveTradeableItem(pItem);
2696 pItem->SetState(ITEM_REMOVED, this);
2697 }
2698
2700
2701 pItem2->SetState(ITEM_CHANGED, this);
2702
2703 return pItem2;
2704 }
2705}
@ BIND_WHEN_EQUIPPED
Definition ItemTemplate.h:97
@ BIND_QUEST_ITEM
Definition ItemTemplate.h:99
@ BIND_WHEN_PICKED_UP
Definition ItemTemplate.h:96
@ CURRENCYTOKEN_SLOT_END
Definition Player.h:744
@ CURRENCYTOKEN_SLOT_START
Definition Player.h:743
@ PLAYER_FIELD_INV_SLOT_HEAD
Definition UpdateFields.h:327
@ ITEM_FIELD_OWNER
Definition UpdateFields.h:35
@ ITEM_FIELD_CONTAINED
Definition UpdateFields.h:36
void StoreItem(uint8 slot, Item *pItem, bool update)
Definition Bag.cpp:154
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition Item.cpp:714
void SetBinding(bool val)
Definition Item.h:235
Item * CloneItem(uint32 count, Player const *player=nullptr) const
Definition Item.cpp:1118
void SetCount(uint32 value)
Definition Item.h:273
void SetNotRefundable(Player *owner, bool changestate=true, CharacterDatabaseTransaction *trans=nullptr)
Definition Item.cpp:1200
void SetSlot(uint8 slot)
Definition Item.h:284
uint32 GetCount() const
Definition Item.h:272
void SetOwnerGUID(ObjectGuid guid)
Definition Item.h:232
void SetContainer(Bag *container)
Definition Item.h:286
virtual void DestroyForPlayer(Player *target, bool onDeath=false) const
Definition Object.cpp:263
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:712
virtual void AddToWorld()
Definition Object.cpp:141
virtual void RemoveFromWorld()
Definition Object.cpp:155
void SendUpdateToPlayer(Player *player)
Definition Object.cpp:235
Bag * GetBagByPos(uint8 slot) const
Definition PlayerStorage.cpp:457
void AddEnchantmentDurations(Item *item)
Definition PlayerStorage.cpp:4186
void RemoveEnchantmentDurations(Item *item)
Definition PlayerStorage.cpp:4199
void AddItemDurations(Item *item)
Definition Player.cpp:12423
void AddKnownCurrency(uint32 itemId)
Definition Player.cpp:14180
uint32 Bonding
Definition ItemTemplate.h:663

References AddEnchantmentDurations(), AddItemDurations(), AddKnownCurrency(), Object::AddToWorld(), BIND_QUEST_ITEM, BIND_WHEN_EQUIPPED, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, Item::ClearSoulboundTradeable(), Item::CloneItem(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, Object::DestroyForPlayer(), GetBagByPos(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, IsBagPos(), Object::IsInWorld(), ITEM_CHANGED, ITEM_FIELD_CONTAINED, ITEM_FIELD_OWNER, ITEM_REMOVED, LOG_DEBUG, m_items, PLAYER_FIELD_INV_SLOT_HEAD, RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDurations(), RemoveTradeableItem(), Object::SendUpdateToPlayer(), Item::SetBinding(), Item::SetContainer(), Item::SetCount(), Object::SetGuidValue(), Item::SetNotRefundable(), Item::SetOwnerGUID(), Item::SetSlot(), Item::SetState(), Bag::StoreItem(), and ObjectGuid::ToString().

Referenced by StoreItem().

◆ _StoreOrEquipNewItem()

bool Player::_StoreOrEquipNewItem ( uint32  vendorslot,
uint32  item,
uint8  count,
uint8  bag,
uint8  slot,
int32  price,
ItemTemplate const *  pProto,
Creature pVendor,
VendorItem const *  crItem,
bool  bStore 
)
inline
10624{
10625 ItemPosCountVec vDest;
10626 uint16 uiDest = 0;
10627 InventoryResult msg = bStore ?
10628 CanStoreNewItem(bag, slot, vDest, item, pProto->BuyCount * count) :
10629 CanEquipNewItem(slot, uiDest, item, false);
10630 if (msg != EQUIP_ERR_OK)
10631 {
10632 SendEquipError(msg, nullptr, nullptr, item);
10633 return false;
10634 }
10635
10636 ModifyMoney(-price);
10637
10638 if (crItem->ExtendedCost) // case for new honor system
10639 {
10640 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
10641 if (iece->reqhonorpoints)
10642 ModifyHonorPoints(- int32(iece->reqhonorpoints * count));
10643
10644 if (iece->reqarenapoints)
10645 ModifyArenaPoints(- int32(iece->reqarenapoints * count));
10646
10647 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
10648 {
10649 if (iece->reqitem[i])
10650 DestroyItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count), true);
10651 }
10652 }
10653
10654 sScriptMgr->OnPlayerBeforeStoreOrEquipNewItem(this, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
10655
10656 Item* it = bStore ? StoreNewItem(vDest, item, true) : EquipNewItem(uiDest, item, true);
10657 if (it)
10658 {
10659 uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, pProto->BuyCount * count);
10660
10661 WorldPacket data(SMSG_BUY_ITEM, (8 + 4 + 4 + 4));
10662 data << pVendor->GetGUID();
10663 data << uint32(vendorslot + 1); // numbered from 1 at client
10664 data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF);
10665 data << uint32(count);
10666 GetSession()->SendPacket(&data);
10667 SendNewItem(it, pProto->BuyCount * count, true, false, false);
10668
10669 if (!bStore)
10671
10672 if (pProto->HasFlag(ITEM_FLAG_ITEM_PURCHASE_RECORD) && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
10673 {
10675 it->SetRefundRecipient(GetGUID().GetCounter());
10676 it->SetPaidMoney(price);
10677 it->SetPaidExtendedCost(crItem->ExtendedCost);
10678 it->SaveRefundDataToDB();
10680 }
10681 }
10682
10683 sScriptMgr->OnPlayerAfterStoreOrEquipNewItem(this, vendorslot, it, count, bag, slot, pProto, pVendor, crItem, bStore);
10684
10685 return true;
10686}
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
#define MAX_ITEM_EXTENDED_COST_REQUIREMENTS
Definition DBCStructure.h:1183
@ ITEM_FLAG_ITEM_PURCHASE_RECORD
Definition ItemTemplate.h:159
InventoryResult
Definition Item.h:46
uint32 UpdateVendorItemCurrentCount(VendorItem const *vItem, uint32 used_count)
Definition Creature.cpp:3110
void SaveRefundDataToDB()
Definition Item.cpp:1172
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:834
InventoryResult CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const
Definition PlayerStorage.cpp:1791
bool ModifyMoney(int32 amount, bool sendError=true)
Definition Player.cpp:11484
Item * EquipNewItem(uint16 pos, uint32 item, bool update)
Definition PlayerStorage.cpp:2707
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition PlayerStorage.cpp:4757
void AutoUnequipOffhandIfNeed(bool force=false)
Definition Player.cpp:12432
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition PlayerStorage.cpp:3121
void ModifyHonorPoints(int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
Definition Player.cpp:6304
void ModifyArenaPoints(int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
If trans is specified, honor save query will be added to trans.
Definition Player.cpp:6320
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition PlayerStorage.cpp:2524
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4021
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1296
Definition WorldPacket.h:26
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:251
@ SMSG_BUY_ITEM
Definition Opcodes.h:450
Definition DBCStructure.h:1186
uint32 reqarenapoints
Definition DBCStructure.h:1189
uint32 reqitemcount[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition DBCStructure.h:1192
uint32 reqitem[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition DBCStructure.h:1191
uint32 reqhonorpoints
Definition DBCStructure.h:1188

References AddRefundReference(), AutoUnequipOffhandIfNeed(), ItemTemplate::BuyCount, CanEquipNewItem(), CanStoreNewItem(), DestroyItemCount(), EQUIP_ERR_OK, EquipNewItem(), VendorItem::ExtendedCost, Object::GetGUID(), Object::GetGUID(), ItemTemplate::GetMaxStackSize(), GetSession(), ItemTemplate::HasFlag(), ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, ITEM_FLAG_ITEM_PURCHASE_RECORD, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, VendorItem::maxcount, ModifyArenaPoints(), ModifyHonorPoints(), ModifyMoney(), ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, Item::SaveRefundDataToDB(), SendEquipError(), SendNewItem(), WorldSession::SendPacket(), Object::SetFlag(), Item::SetPaidExtendedCost(), Item::SetPaidMoney(), Item::SetRefundRecipient(), sItemExtendedCostStore, SMSG_BUY_ITEM, sScriptMgr, StoreNewItem(), and Creature::UpdateVendorItemCurrentCount().

Referenced by BuyItemFromVendorSlot().

◆ AbandonQuest()

void Player::AbandonQuest ( uint32  quest_id)
931{
932 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
933 {
934 // It will Destroy quest items on quests abandons.
935 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
936 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
937 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
938 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
939
940 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
941 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
942 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
943 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
944 }
945}
#define QUEST_SOURCE_ITEM_IDS_COUNT
Definition QuestDef.h:37

References BIND_QUEST_ITEM, DestroyItemCount(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, and sObjectMgr.

Referenced by WorldSession::HandleQuestLogRemoveQuest().

◆ ActivateSpec()

void Player::ActivateSpec ( uint8  spec)
15038{
15039 // xinef: some basic checks
15040 if (GetActiveSpec() == spec)
15041 return;
15042
15043 if (spec > GetSpecsCount())
15044 return;
15045
15046 // xinef: interrupt currently casted spell just in case
15047 if (IsNonMeleeSpellCast(false))
15049
15050 // xinef: save current actions order
15051 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15052 _SaveActions(trans);
15053 CharacterDatabase.CommitTransaction(trans);
15054
15055 // xinef: remove pet, it will be resummoned later
15056 if (Pet* pet = GetPet())
15058
15059 // xinef: remove other summoned units and clear reactives
15063
15064 // xinef: let client clear his current Actions
15066 uint8 oldSpec = GetActiveSpec();
15067
15068 std::unordered_set<uint32> removedSpecAuras;
15069
15070 // xinef: reset talent auras
15071 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
15072 {
15073 if (itr->second->State == PLAYERSPELL_REMOVED)
15074 continue;
15075
15076 // xinef: remove all active talent auras
15077 if (!(itr->second->specMask & GetActiveSpecMask()))
15078 continue;
15079
15080 _removeTalentAurasAndSpells(itr->first);
15081
15082 // pussywizard: was => isn't
15083 if (!itr->second->IsInSpec(spec) && !itr->second->inSpellBook)
15084 SendLearnPacket(itr->first, false);
15085
15086 removedSpecAuras.insert(itr->first);
15087 }
15088
15089 // xinef: remove glyph auras
15090 for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
15091 if (uint32 glyphId = m_Glyphs[GetActiveSpec()][slot])
15092 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
15093 {
15094 RemoveAurasDueToSpell(glyphEntry->SpellId);
15095 removedSpecAuras.insert(glyphEntry->SpellId);
15096 }
15097
15098 // xinef: set active spec as new one
15099 SetActiveSpec(spec);
15100 uint32 spentTalents = 0;
15101
15102 // xinef: add talent auras
15103 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
15104 {
15105 if (itr->second->State == PLAYERSPELL_REMOVED)
15106 continue;
15107
15108 // xinef: talent not in new spec
15109 if (!(itr->second->specMask & GetActiveSpecMask()))
15110 continue;
15111
15112 // pussywizard: wasn't => is
15113 if (!itr->second->IsInSpec(oldSpec) && !itr->second->inSpellBook)
15114 SendLearnPacket(itr->first, true);
15115
15116 _addTalentAurasAndSpells(itr->first);
15117 TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first);
15118 spentTalents += talentPos->rank + 1;
15119
15120 removedSpecAuras.erase(itr->first);
15121 }
15122
15123 // pussywizard: remove spells that are in previous spec, but are not present in new one (or are in new spec, but not in the old one)
15124 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
15125 {
15126 if (!itr->second->Active || itr->second->State == PLAYERSPELL_REMOVED)
15127 continue;
15128
15129 // pussywizard: was => isn't
15130 if (itr->second->IsInSpec(oldSpec) && !itr->second->IsInSpec(spec))
15131 {
15132 SendLearnPacket(itr->first, false);
15133 // We want to remove all auras of the unlearned spell
15134 _removeTalentAurasAndSpells(itr->first);
15135
15136 removedSpecAuras.insert(itr->first);
15137 }
15138 // pussywizard: wasn't => is
15139 else if (!itr->second->IsInSpec(oldSpec) && itr->second->IsInSpec(spec))
15140 {
15141 SendLearnPacket(itr->first, true);
15142
15143 removedSpecAuras.erase(itr->first);
15144 }
15145 }
15146
15147 // xinef: apply glyphs from second spec
15148 if (GetActiveSpec() != oldSpec)
15149 {
15150 for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
15151 {
15152 uint32 glyphId = m_Glyphs[GetActiveSpec()][slot];
15153 if (glyphId)
15154 {
15155 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
15156 {
15158 removedSpecAuras.erase(glyphEntry->SpellId);
15159 }
15160 }
15161
15162 SetGlyph(slot, glyphId, true);
15163 }
15164 }
15165
15166 // Remove auras triggered/activated by talents/glyphs
15167 // Mostly explicit casts in dummy aura scripts
15168 if (!removedSpecAuras.empty())
15169 {
15170 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
15171 {
15172 Aura* aura = iter->second;
15173 if (SpellInfo const* triggeredByAuraSpellInfo = aura->GetTriggeredByAuraSpellInfo())
15174 {
15175 if (removedSpecAuras.find(triggeredByAuraSpellInfo->Id) != removedSpecAuras.end())
15176 {
15177 RemoveOwnedAura(iter);
15178 continue;
15179 }
15180 }
15181 ++iter;
15182 }
15183 }
15184
15185 m_usedTalentCount = spentTalents;
15187
15188 // load them asynchronously
15189 {
15191 stmt->SetData(0, GetGUID().GetCounter());
15192 stmt->SetData(1, m_activeSpec);
15193
15194 WorldSession* mySess = GetSession();
15195 mySess->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(stmt)
15196 .WithPreparedCallback([mySess](PreparedQueryResult result)
15197 {
15198 // safe callback, we can't pass this pointer directly
15199 // in case player logs out before db response (player would be deleted in that case)
15200 if (Player* thisPlayer = mySess->GetPlayer())
15201 thisPlayer->LoadActions(result);
15202 }));
15203 }
15204
15205 // xinef: reset power
15206 Powers pw = getPowerType();
15207 if (pw != POWER_MANA)
15208 SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type.
15209 SetPower(pw, 0);
15210
15211 // xinef: remove titan grip if player had it set and does not have appropriate talent
15212 if (!HasTalent(46917, GetActiveSpec()) && m_canTitanGrip)
15213 SetCanTitanGrip(false);
15214 // xinef: remove dual wield if player does not have dual wield spell (shamans)
15215 if (!HasSpell(674) && m_canDualWield)
15216 SetCanDualWield(false);
15217
15219
15220 // Xinef: Patch 3.2.0: Switching spec removes paladins spell Righteous Fury (25780)
15222 RemoveAurasDueToSpell(25780);
15223
15224 // Xinef: Remove talented single target auras at other targets
15225 AuraList& scAuras = GetSingleCastAuras();
15226 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
15227 {
15228 Aura* aura = *iter;
15229 if (!HasActiveSpell(aura->GetId()) && !HasTalent(aura->GetId(), GetActiveSpec()) && !aura->GetCastItemGUID())
15230 {
15231 aura->Remove();
15232 iter = scAuras.begin();
15233 }
15234 else
15235 ++iter;
15236 }
15237
15238 sScriptMgr->OnPlayerAfterSpecSlotChanged(this, GetActiveSpec());
15239}
@ CHAR_SEL_CHARACTER_ACTIONS_SPEC
Definition CharacterDatabase.h:81
@ POWER_MANA
Definition SharedDefines.h:269
@ CLASS_PALADIN
Definition SharedDefines.h:142
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:234
T & AddCallback(T &&query)
Definition AsyncCallbackProcessor.h:34
uint32 GetId() const
Definition SpellAuras.cpp:466
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
SpellInfo const * GetTriggeredByAuraSpellInfo() const
Definition SpellAuras.cpp:2761
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
Definition Pet.h:41
void InitTalentForLevel()
Definition Player.cpp:2573
void SetCanTitanGrip(bool value)
Definition Player.cpp:13109
void SetActiveSpec(uint8 spec)
Definition Player.h:1756
Pet * GetPet() const
Definition Player.cpp:8936
bool HasTalent(uint32 spell_id, uint8 spec) const
Definition Player.cpp:3910
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:9086
void _SaveActions(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7149
uint8 GetActiveSpecMask() const
Definition Player.h:1755
uint8 GetSpecsCount() const
Definition Player.h:1757
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3904
void SendActionButtons(uint32 state) const
Definition Player.cpp:5584
void _addTalentAurasAndSpells(uint32 spellId)
Definition Player.cpp:3028
virtual void SetCanDualWield(bool value)
Definition Unit.h:919
std::list< Aura * > AuraList
Definition Unit.h:637
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4176
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15658
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4146
void ClearAllReactives()
Definition Unit.cpp:17001
void UnsummonAllTotems(bool onDeath=false)
Definition Unit.cpp:11288
bool m_canDualWield
Definition Unit.h:1988
Powers getPowerType() const
Definition Unit.h:1054
AuraList & GetSingleCastAuras()
Definition Unit.h:1352
void RemoveAllControlled(bool onDeath=false)
Definition Unit.cpp:11172
Player session in the World.
Definition WorldSession.h:330
QueryCallbackProcessor & GetQueryProcessor()
Definition WorldSession.h:1092
uint8 rank
Definition DBCStructure.h:2238

References _addTalentAurasAndSpells(), _removeTalentAurasAndSpells(), _SaveActions(), AsyncCallbackProcessor< T >::AddCallback(), AutoUnequipOffhandIfNeed(), Unit::CastSpell(), CHAR_SEL_CHARACTER_ACTIONS_SPEC, CharacterDatabase, CLASS_CONTEXT_ABILITY, CLASS_PALADIN, Unit::ClearAllReactives(), GetActiveSpec(), GetActiveSpecMask(), Aura::GetCastItemGUID(), Object::GetGUID(), Aura::GetId(), GetPet(), Unit::getPowerType(), WorldSession::GetQueryProcessor(), GetSession(), Unit::GetSingleCastAuras(), GetSpecsCount(), GetTalentSpellPos(), Aura::GetTriggeredByAuraSpellInfo(), HasActiveSpell(), HasSpell(), HasTalent(), InitTalentForLevel(), Unit::InterruptNonMeleeSpells(), IsClass(), Unit::IsNonMeleeSpellCast(), m_activeSpec, Unit::m_canDualWield, m_canTitanGrip, m_Glyphs, Unit::m_ownedAuras, m_spells, m_talents, m_usedTalentCount, MAX_GLYPH_SLOT_INDEX, PET_SAVE_NOT_IN_SLOT, PLAYERSPELL_REMOVED, POWER_MANA, TalentSpellPos::rank, Aura::Remove(), Unit::RemoveAllControlled(), Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), RemovePet(), SendActionButtons(), SendLearnPacket(), SetActiveSpec(), Unit::SetCanDualWield(), SetCanTitanGrip(), PreparedStatementBase::SetData(), SetGlyph(), Unit::SetPower(), sGlyphPropertiesStore, sScriptMgr, TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_CASTER_AURASTATE, TRIGGERED_IGNORE_SHAPESHIFT, and Unit::UnsummonAllTotems().

Referenced by UpdateSpecCount().

◆ ActivateTaxiPathTo() [1/2]

bool Player::ActivateTaxiPathTo ( std::vector< uint32 > const &  nodes,
Creature npc = nullptr,
uint32  spellid = 1 
)
10223{
10224 if (nodes.size() < 2)
10225 return false;
10226
10227 // not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root
10229 {
10231 return false;
10232 }
10233
10235 return false;
10236
10237 // taximaster case
10238 if (npc)
10239 {
10240 // not let cheating with start flight mounted
10241 if (IsMounted())
10242 {
10244 return false;
10245 }
10246
10248 {
10250 return false;
10251 }
10252
10253 // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi
10254 if (IsNonMeleeSpellCast(false))
10255 {
10257 return false;
10258 }
10259 }
10260 // cast case or scripted call case
10261 else
10262 {
10264
10267
10269 if (spell->m_spellInfo->Id != spellid)
10271
10273
10275 if (spell->m_spellInfo->Id != spellid)
10277 }
10278
10279 uint32 sourcenode = nodes[0];
10280
10281 // starting node too far away (cheat?)
10282 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(sourcenode);
10283 if (!node)
10284 {
10286 return false;
10287 }
10288
10289 // Prepare to flight start now
10290
10291 // stop combat at start taxi flight if any
10292 CombatStop();
10293
10296 ExitVehicle();
10297
10298 // stop trade (client cancel trade at taxi map open but cheating tools can be used for reopen it)
10299 TradeCancel(true);
10300
10301 // clean not finished taxi path if any
10303
10304 // 0 element current node
10305 m_taxi.AddTaxiDestination(sourcenode);
10306
10307 // fill destinations path tail
10308 uint32 sourcepath = 0;
10309 uint32 totalcost = 0;
10310 uint32 firstcost = 0;
10311
10312 uint32 prevnode = sourcenode;
10313 uint32 lastnode = 0;
10314
10315 for (uint32 i = 1; i < nodes.size(); ++i)
10316 {
10317 uint32 path, cost;
10318
10319 lastnode = nodes[i];
10320 sObjectMgr->GetTaxiPath(prevnode, lastnode, path, cost);
10321
10322 if (!path)
10323 {
10325 return false;
10326 }
10327
10328 totalcost += cost;
10329 if (i == 1)
10330 firstcost = cost;
10331
10332 if (prevnode == sourcenode)
10333 sourcepath = path;
10334
10335 m_taxi.AddTaxiDestination(lastnode);
10336
10337 prevnode = lastnode;
10338 }
10339
10340 // get mount model (in case non taximaster (npc == nullptr) allow more wide lookup)
10341 //
10342 // Hack-Fix for Alliance not being able to use Acherus taxi. There is
10343 // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes
10344 // change but I couldn't find a suitable alternative. OK to use class because only DK
10345 // can use this taxi.
10346 uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == nullptr || (sourcenode == 315 && IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_TAXI)));
10347
10348 // in spell case allow 0 model
10349 if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
10350 {
10353 return false;
10354 }
10355
10356 uint32 money = GetMoney();
10357
10358 if (npc)
10359 {
10360 float discount = GetReputationPriceDiscount(npc);
10361 totalcost = uint32(ceil(totalcost * discount));
10362 firstcost = uint32(ceil(firstcost * discount));
10364 }
10365 else
10366 {
10368 }
10369
10370 if (money < totalcost)
10371 {
10374 return false;
10375 }
10376
10377 //Checks and preparations done, DO FLIGHT
10379
10380 // prevent stealth flight
10381 //RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
10382
10383 // Xinef: dont use instant flight paths if spellid is present (custom calls use spellid = 1)
10384 if ((sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 1 || (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && m_isInstantFlightOn)) && !spellid)
10385 {
10386 TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size() - 1]);
10388 ModifyMoney(-(int32)totalcost);
10390 TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation());
10391 return false;
10392 }
10393 else
10394 {
10395 m_flightSpellActivated = spellid;
10396 ModifyMoney(-(int32)firstcost);
10399 GetSession()->SendDoFlight(mount_display_id, sourcepath);
10400 }
10401 return true;
10402}
npc
Definition BattlegroundSA.h:47
@ ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN
Definition DBCEnums.h:215
@ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING
Definition DBCEnums.h:176
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ ERR_TAXIPLAYERBUSY
Definition SharedDefines.h:3857
@ ERR_TAXIOK
Definition SharedDefines.h:3850
@ ERR_TAXINOSUCHPATH
Definition SharedDefines.h:3852
@ ERR_TAXIUNSPECIFIEDSERVERERROR
Definition SharedDefines.h:3851
@ ERR_TAXIPLAYERSHAPESHIFTED
Definition SharedDefines.h:3859
@ ERR_TAXIPLAYERALREADYMOUNTED
Definition SharedDefines.h:3858
@ ERR_TAXINOTENOUGHMONEY
Definition SharedDefines.h:3853
@ SPELL_AURA_MOD_SHAPESHIFT
Definition SpellAuraDefines.h:99
@ CLASS_CONTEXT_TAXI
Definition UnitDefines.h:231
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173
@ UNIT_FLAG_DISABLE_MOVE
Definition UnitDefines.h:252
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:540
@ CURRENT_GENERIC_SPELL
Definition Unit.h:539
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:541
@ CONFIG_INSTANT_TAXI
Definition WorldConfig.h:337
void AddTaxiDestination(uint32 dest)
Definition PlayerTaxi.h:62
void SetFlightMasterFactionTemplateId(uint32 factionTemplateId)
Definition PlayerTaxi.h:78
void ClearTaxiDestinations()
Definition PlayerTaxi.h:61
TeamId GetTeamId(bool original=false) const
Definition Player.h:2126
float GetReputationPriceDiscount(Creature const *creature) const
Definition Player.cpp:12305
void TradeCancel(bool sendback, TradeStatus status=TRADE_STATUS_TRADE_CANCELED)
Definition PlayerStorage.cpp:4088
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1345
void StopCastingCharm(Aura *except=nullptr)
Definition Player.cpp:9323
void StopCastingBindSight(Aura *except=nullptr)
Definition Player.cpp:13122
Definition Spell.h:287
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4107
void CombatStop(bool includingCast=false)
Definition Unit.cpp:10522
bool IsInDisallowedMountForm() const
Definition Unit.cpp:21126
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:702
bool IsMounted() const
Definition Unit.h:1800
bool HasUnitState(const uint32 f) const
Definition Unit.h:691
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5166
bool IsInCombat() const
Definition Unit.h:879
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:19556
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1495
void SendActivateTaxiReply(ActivateTaxiReply reply)
Definition TaxiHandler.cpp:279
void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode=0)
Definition TaxiHandler.cpp:109
Definition DBCStructure.h:1954
float z
Definition DBCStructure.h:1959
uint32 map_id
Definition DBCStructure.h:1956
float x
Definition DBCStructure.h:1957
float y
Definition DBCStructure.h:1958

References ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, PlayerTaxi::AddTaxiDestination(), CLASS_CONTEXT_TAXI, CLASS_DEATH_KNIGHT, PlayerTaxi::ClearTaxiDestinations(), Unit::CombatStop(), CONFIG_INSTANT_TAXI, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, ERR_TAXINOSUCHPATH, ERR_TAXINOTENOUGHMONEY, ERR_TAXIOK, ERR_TAXIPLAYERALREADYMOUNTED, ERR_TAXIPLAYERBUSY, ERR_TAXIPLAYERSHAPESHIFTED, ERR_TAXIUNSPECIFIEDSERVERERROR, Unit::ExitVehicle(), Unit::GetCurrentSpell(), GetMoney(), Position::GetOrientation(), GetReputationPriceDiscount(), GetSession(), GetTeamId(), Unit::HasUnitFlag(), Unit::HasUnitState(), Unit::InterruptSpell(), IsClass(), Unit::IsInCombat(), Unit::IsInDisallowedMountForm(), Unit::IsMounted(), Unit::IsNonMeleeSpellCast(), m_flightSpellActivated, m_isInstantFlightOn, m_taxi, TaxiNodesEntry::map_id, ModifyMoney(), Unit::RemoveAurasByType(), WorldSession::SendActivateTaxiReply(), WorldSession::SendDoFlight(), PlayerTaxi::SetFlightMasterFactionTemplateId(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sTaxiNodesStore, StopCastingBindSight(), StopCastingCharm(), sWorld, TeleportTo(), TradeCancel(), UNIT_FLAG_DISABLE_MOVE, UNIT_STATE_ROOT, UNIT_STATE_STUNNED, UpdateAchievementCriteria(), TaxiNodesEntry::x, TaxiNodesEntry::y, and TaxiNodesEntry::z.

Referenced by ActivateTaxiPathTo(), WorldSession::HandleActivateTaxiExpressOpcode(), WorldSession::HandleActivateTaxiOpcode(), Aura::HandleAuraSpecificMods(), OPvPCapturePointNA::HandleCustomSpell(), npc_taxi::OnGossipSelect(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), and npc_karynaku::OnQuestAccept().

◆ ActivateTaxiPathTo() [2/2]

bool Player::ActivateTaxiPathTo ( uint32  taxi_path_id,
uint32  spellid = 1 
)
10405{
10406 TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id);
10407 if (!entry)
10408 return false;
10409
10410 std::vector<uint32> nodes;
10411
10412 nodes.resize(2);
10413 nodes[0] = entry->from;
10414 nodes[1] = entry->to;
10415
10416 return ActivateTaxiPathTo(nodes, nullptr, spellid);
10417}
DBCStorage< TaxiPathEntry > sTaxiPathStore(TaxiPathEntryfmt)
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
Definition Player.cpp:10222
Definition DBCStructure.h:1966
uint32 to
Definition DBCStructure.h:1969
uint32 from
Definition DBCStructure.h:1968

References ActivateTaxiPathTo(), TaxiPathEntry::from, sTaxiPathStore, and TaxiPathEntry::to.

◆ addActionButton()

ActionButton * Player::addActionButton ( uint8  button,
uint32  action,
uint8  type 
)
5656{
5657 if (!IsActionButtonDataValid(button, action, type))
5658 return nullptr;
5659
5660 // it create new button (NEW state) if need or return existed
5661 ActionButton& ab = m_actionButtons[button];
5662
5663 // set data and update to CHANGED if not NEW
5664 ab.SetActionAndType(action, ActionButtonType(type));
5665
5666 LOG_DEBUG("entities.player", "Player {} Added Action {} (type {}) to Button {}", GetGUID().ToString(), action, type, button);
5667 return &ab;
5668}
ActionButtonType
Definition Player.h:229
bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
Definition Player.cpp:5612
void SetActionAndType(uint32 action, ActionButtonType type)
Definition Player.h:268

References Object::GetGUID(), IsActionButtonDataValid(), LOG_DEBUG, m_actionButtons, ActionButton::SetActionAndType(), and Position::ToString().

Referenced by _LoadActions(), Create(), and WorldSession::HandleSetActionButtonOpcode().

◆ AddArmorProficiency()

void Player::AddArmorProficiency ( uint32  newflag)
inline
1375{ m_ArmorProficiency |= newflag; }

References m_ArmorProficiency.

Referenced by Spell::EffectProficiency().

◆ AddBattlegroundQueueId()

uint32 Player::AddBattlegroundQueueId ( BattlegroundQueueTypeId  val)
12214{
12215 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12216 {
12217 if (_BgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || _BgBattlegroundQueueID[i].bgQueueTypeId == val)
12218 {
12219 _BgBattlegroundQueueID[i].bgQueueTypeId = val;
12220 _BgBattlegroundQueueID[i].invitedToInstance = 0;
12221 return i;
12222 }
12223 }
12224
12226}

References _BgBattlegroundQueueID, BATTLEGROUND_QUEUE_NONE, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by WorldSession::HandleBattlemasterJoinArena(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ AddBonusTalent()

void Player::AddBonusTalent ( uint32  count)
inline
1749{ m_extraBonusTalentCount += count; };

References m_extraBonusTalentCount.

◆ AddEnchantmentDuration()

void Player::AddEnchantmentDuration ( Item item,
EnchantmentSlot  slot,
uint32  duration 
)
4275{
4276 if (!item)
4277 return;
4278
4279 if (slot >= MAX_ENCHANTMENT_SLOT)
4280 return;
4281
4282 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4283 {
4284 if (itr->item == item && itr->slot == slot)
4285 {
4286 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
4287 m_enchantDuration.erase(itr);
4288 break;
4289 }
4290 }
4291 if (item && duration > 0)
4292 {
4293 GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration / 1000));
4294 m_enchantDuration.push_back(EnchantDuration(item, slot, duration));
4295 }
4296}
@ MAX_ENCHANTMENT_SLOT
Definition Item.h:183
void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
Definition ItemHandler.cpp:1234
Definition Player.h:447

References Object::GetGUID(), Object::GetGUID(), GetSession(), m_enchantDuration, MAX_ENCHANTMENT_SLOT, and WorldSession::SendItemEnchantTimeUpdate().

Referenced by AddEnchantmentDurations(), and ApplyEnchantment().

◆ AddEnchantmentDurations()

void Player::AddEnchantmentDurations ( Item item)
4187{
4188 for (int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x)
4189 {
4190 if (!item->GetEnchantmentId(EnchantmentSlot(x)))
4191 continue;
4192
4193 uint32 duration = item->GetEnchantmentDuration(EnchantmentSlot(x));
4194 if (duration > 0)
4195 AddEnchantmentDuration(item, EnchantmentSlot(x), duration);
4196 }
4197}
EnchantmentSlot
Definition Item.h:168
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:304
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition Item.h:305
void AddEnchantmentDuration(Item *item, EnchantmentSlot slot, uint32 duration)
Definition PlayerStorage.cpp:4274

References AddEnchantmentDuration(), Item::GetEnchantmentDuration(), Item::GetEnchantmentId(), and MAX_ENCHANTMENT_SLOT.

Referenced by _StoreItem(), EquipItem(), and QuickEquipItem().

◆ AddInstanceEnterTime()

void Player::AddInstanceEnterTime ( uint32  instanceId,
time_t  enterTime 
)
inline
2468 {
2469 if (_instanceResetTimes.find(instanceId) == _instanceResetTimes.end())
2470 _instanceResetTimes.insert(InstanceTimeMap::value_type(instanceId, enterTime + HOUR));
2471 }

References _instanceResetTimes, and HOUR.

Referenced by InstanceMap::AddPlayerToMap().

◆ AddItem()

bool Player::AddItem ( uint32  itemId,
uint32  count 
)
15528{
15529 uint32 noSpaceForCount = 0;
15530 ItemPosCountVec dest;
15531 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
15532 if (msg != EQUIP_ERR_OK)
15533 count -= noSpaceForCount;
15534
15535 if (count == 0 || dest.empty())
15536 {
15537 // -- TODO: Send to mailbox if no space
15538 ChatHandler(GetSession()).PSendSysMessage("You don't have any space in your bags.");
15539 return false;
15540 }
15541
15542 Item* item = StoreNewItem(dest, itemId, true);
15543 if (item)
15544 SendNewItem(item, count, true, false);
15545 else
15546 return false;
15547 return true;
15548}
@ NULL_BAG
Definition Item.h:40
Definition Chat.h:37
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211

References CanStoreNewItem(), EQUIP_ERR_OK, GetSession(), NULL_BAG, NULL_SLOT, ChatHandler::PSendSysMessage(), SendNewItem(), and StoreNewItem().

Referenced by spell_brewfest_fill_keg::HandleAfterHit(), spell_brewfest_unfill_keg::HandleAfterHit(), spell_q9452_cast_net::HandleDummy(), spell_catch_the_wild_wolpertinger::HandleEffectApply(), RewardHonor(), and npc_tharnarian::npc_tharnarianAI::sGossipSelect().

◆ AddItemDurations()

void Player::AddItemDurations ( Item item)
12424{
12426 {
12427 m_itemDuration.push_back(item);
12428 item->SendTimeUpdate(this);
12429 }
12430}
@ ITEM_FIELD_DURATION
Definition UpdateFields.h:40
void SendTimeUpdate(Player *owner)
Definition Item.cpp:1075
ItemDurationList m_itemDuration
Definition Player.h:2855

References Object::GetUInt32Value(), ITEM_FIELD_DURATION, m_itemDuration, and Item::SendTimeUpdate().

Referenced by _StoreItem(), EquipItem(), and QuickEquipItem().

◆ AddItemToBuyBackSlot()

void Player::AddItemToBuyBackSlot ( Item pItem,
uint32  money 
)
3937{
3938 if (pItem)
3939 {
3941 // if current back slot non-empty search oldest or free
3942 if (m_items[slot])
3943 {
3945 uint32 oldest_slot = BUYBACK_SLOT_START;
3946
3947 for (uint32 i = BUYBACK_SLOT_START + 1; i < BUYBACK_SLOT_END; ++i)
3948 {
3949 // found empty
3950 if (!m_items[i])
3951 {
3952 slot = i;
3953 break;
3954 }
3955
3957
3958 if (oldest_time > i_time)
3959 {
3960 oldest_time = i_time;
3961 oldest_slot = i;
3962 }
3963 }
3964
3965 // find oldest
3966 slot = oldest_slot;
3967 }
3968
3969 RemoveItemFromBuyBackSlot(slot, true);
3970 LOG_DEBUG("entities.player.items", "STORAGE: AddItemToBuyBackSlot item = {}, slot = {}", pItem->GetEntry(), slot);
3971
3972 m_items[slot] = pItem;
3973 time_t base = GameTime::GetGameTime().count();
3974 uint32 etime = uint32(base - m_logintime + (30 * 3600));
3975 uint32 eslot = slot - BUYBACK_SLOT_START;
3976
3980
3981 // move to next (for non filled list is move most optimized choice)
3984 }
3985}
@ PLAYER_FIELD_BUYBACK_PRICE_1
Definition UpdateFields.h:372
@ PLAYER_FIELD_VENDORBUYBACK_SLOT_1
Definition UpdateFields.h:331
@ PLAYER_FIELD_BUYBACK_TIMESTAMP_1
Definition UpdateFields.h:373
void RemoveItemFromBuyBackSlot(uint32 slot, bool del)
Definition PlayerStorage.cpp:3995

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetUInt32Value(), LOG_DEBUG, m_currentBuybackSlot, m_items, m_logintime, PLAYER_FIELD_BUYBACK_PRICE_1, PLAYER_FIELD_BUYBACK_TIMESTAMP_1, PLAYER_FIELD_VENDORBUYBACK_SLOT_1, RemoveItemFromBuyBackSlot(), Object::SetGuidValue(), and Unit::SetUInt32Value().

Referenced by WorldSession::HandleSellItemOpcode().

◆ AdditionalSavingAddMask()

◆ AddKnownCurrency()

void Player::AddKnownCurrency ( uint32  itemId)
private
14181{
14182 if (CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
14183 SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (1LL << (ctEntry->BitIndex - 1)));
14184}
DBCStorage< CurrencyTypesEntry > sCurrencyTypesStore(CurrencyTypesfmt)
void SetFlag64(uint16 index, uint64 newFlag)
Definition Object.cpp:945
Definition DBCStructure.h:835

References PLAYER_FIELD_KNOWN_CURRENCIES, sCurrencyTypesStore, and Object::SetFlag64().

Referenced by _StoreItem(), SetArenaPoints(), and SetHonorPoints().

◆ AddMail()

void Player::AddMail ( Mail mail)
inline
1661{ m_mail.push_front(mail); }// for call from WorldSession::SendMailTo

References m_mail.

Referenced by MailDraft::SendMailTo().

◆ AddMItem()

void Player::AddMItem ( Item it)
inline
1687 {
1688 ASSERT(it);
1689 //ASSERT deleted, because items can be added before loading
1690 mMitems[it->GetGUID().GetCounter()] = it;
1691 }

References ASSERT, ObjectGuid::GetCounter(), Object::GetGUID(), and mMitems.

Referenced by _LoadMailedItem(), and MailDraft::SendMailTo().

◆ AddNewMailDeliverTime()

void Player::AddNewMailDeliverTime ( time_t  deliver_time)
2898{
2899 if (deliver_time <= GameTime::GetGameTime().count()) // ready now
2900 {
2901 ++unReadMails;
2902 SendNewMail();
2903 }
2904 else // not ready and no have ready mails
2905 {
2906 if (!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time)
2907 m_nextMailDelivereTime = deliver_time;
2908 }
2909}
void SendNewMail()
Definition Player.cpp:2889

References GameTime::GetGameTime(), m_nextMailDelivereTime, SendNewMail(), and unReadMails.

Referenced by MailDraft::SendMailTo().

◆ AddQuest()

void Player::AddQuest ( Quest const *  quest,
Object questGiver 
)
508{
509 uint16 log_slot = FindQuestSlot(0);
510
511 if (log_slot >= MAX_QUEST_LOG_SIZE) // Player does not have any free slot in the quest log
512 return;
513
514 uint32 quest_id = quest->GetQuestId();
515
516 // if not exist then created with set uState == NEW and rewarded=false
517 QuestStatusData& questStatusData = m_QuestStatus[quest_id];
518
519 // check for repeatable quests status reset
520 questStatusData.Status = QUEST_STATUS_INCOMPLETE;
521 questStatusData.Explored = false;
522
523 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
524 {
525 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
526 questStatusData.ItemCount[i] = 0;
527 }
528
530 {
531 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
532 questStatusData.CreatureOrGOCount[i] = 0;
533 }
534
535 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL))
536 questStatusData.PlayerCount = 0;
537
538 GiveQuestSourceItem(quest);
539 AdjustQuestReqItemCount(quest, questStatusData);
540
541 if (quest->GetRepObjectiveFaction())
542 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->GetRepObjectiveFaction()))
543 GetReputationMgr().SetVisible(factionEntry);
544
545 if (quest->GetRepObjectiveFaction2())
546 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->GetRepObjectiveFaction2()))
547 GetReputationMgr().SetVisible(factionEntry);
548
549 uint32 qtime = 0;
550 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
551 {
552 uint32 timeAllowed = quest->GetTimeAllowed();
553
554 // shared timed quest
555 if (questGiver && questGiver->IsPlayer())
556 timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
557
558 AddTimedQuest(quest_id);
559 questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
560 qtime = static_cast<uint32>(GameTime::GetGameTime().count()) + timeAllowed;
561 }
562 else
563 questStatusData.Timer = 0;
564
565 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
566 {
567 pvpInfo.IsHostile = true;
569 }
570
571 SetQuestSlot(log_slot, quest_id, qtime);
572
573 m_QuestStatusSave[quest_id] = true;
574
576
577 SendQuestUpdate(quest_id);
578
579 // check if Quest Tracker is enabled
580 if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
581 {
582 // prepare Quest Tracker datas
583 auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
584 stmt->SetData(0, quest_id);
585 stmt->SetData(1, GetGUID().GetCounter());
586 stmt->SetData(2, GitRevision::GetHash());
587 stmt->SetData(3, GitRevision::GetDate());
588
589 // add to Quest Tracker
590 CharacterDatabase.Execute(stmt);
591 }
592
593 // Xinef: area auras may change on quest accept!
596}
@ CHAR_INS_QUEST_TRACK
Definition CharacterDatabase.h:503
@ ACHIEVEMENT_TIMED_TYPE_QUEST
Definition DBCEnums.h:111
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ QUEST_FLAGS_FLAGS_PVP
Definition QuestDef.h:145
@ QUEST_SPECIAL_FLAGS_CAST
Definition QuestDef.h:165
@ QUEST_SPECIAL_FLAGS_DELIVER
Definition QuestDef.h:175
@ QUEST_SPECIAL_FLAGS_KILL
Definition QuestDef.h:177
@ QUEST_SPECIAL_FLAGS_SPEAKTO
Definition QuestDef.h:176
@ QUEST_SPECIAL_FLAGS_PLAYER_KILL
Definition QuestDef.h:179
@ CONFIG_QUEST_ENABLE_QUEST_TRACKER
Definition WorldConfig.h:105
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition Player.cpp:13892
QuestStatusMap & getQuestStatusMap()
Definition Player.h:1639
uint16 FindQuestSlot(uint32 quest_id) const
Definition PlayerQuest.cpp:1782
void UpdatePvPState()
Definition PlayerUpdates.cpp:1440
void UpdateAreaDependentAuras(uint32 area_id)
Definition PlayerUpdates.cpp:1869
void SendQuestUpdate(uint32 questId)
Definition PlayerQuest.cpp:1526
void AdjustQuestReqItemCount(Quest const *quest, QuestStatusData &questStatusData)
Definition PlayerQuest.cpp:1764
PvPInfo pvpInfo
Definition Player.h:1860
void UpdateZoneDependentAuras(uint32 zone_id)
Definition PlayerUpdates.cpp:1855
bool GiveQuestSourceItem(Quest const *quest)
Definition PlayerQuest.cpp:1335
ReputationMgr & GetReputationMgr()
Definition Player.h:2143
void SetVisible(FactionTemplateEntry const *factionTemplateEntry)
Definition ReputationMgr.cpp:461
uint32 GetAreaId() const
Definition Object.cpp:3029
AC_COMMON_API char const * GetDate()
Definition GitRevision.cpp:26
AC_COMMON_API char const * GetHash()
Definition GitRevision.cpp:21
Definition DBCStructure.h:907
bool IsHostile
Definition Player.h:366

References ACHIEVEMENT_TIMED_TYPE_QUEST, AddTimedQuest(), AdjustQuestReqItemCount(), CHAR_INS_QUEST_TRACK, CharacterDatabase, CONFIG_QUEST_ENABLE_QUEST_TRACKER, QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, FindQuestSlot(), WorldObject::GetAreaId(), GitRevision::GetDate(), GameTime::GetGameTime(), Object::GetGUID(), GitRevision::GetHash(), Quest::GetQuestId(), getQuestStatusMap(), Quest::GetRepObjectiveFaction(), Quest::GetRepObjectiveFaction2(), GetReputationMgr(), Quest::GetTimeAllowed(), WorldObject::GetZoneId(), GiveQuestSourceItem(), Quest::HasFlag(), Quest::HasSpecialFlag(), IN_MILLISECONDS, PvPInfo::IsHostile, Object::IsPlayer(), QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QuestStatusData::PlayerCount, pvpInfo, QUEST_FLAGS_FLAGS_PVP, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATUS_INCOMPLETE, SendQuestUpdate(), SetQuestSlot(), ReputationMgr::SetVisible(), sFactionStore, StartTimedAchievement(), QuestStatusData::Status, sWorld, QuestStatusData::Timer, Object::ToPlayer(), UpdateAreaDependentAuras(), UpdatePvPState(), and UpdateZoneDependentAuras().

Referenced by AddQuestAndCheckCompletion().

◆ AddQuestAndCheckCompletion()

void Player::AddQuestAndCheckCompletion ( Quest const *  quest,
Object questGiver 
)
422{
423 AddQuest(quest, questGiver);
424
425 if (CanCompleteQuest(quest->GetQuestId()))
426 CompleteQuest(quest->GetQuestId());
427
428 if (!questGiver)
429 return;
430
431 switch (questGiver->GetTypeId())
432 {
433 case TYPEID_UNIT:
434 sScriptMgr->OnQuestAccept(this, questGiver->ToCreature(), quest);
435 questGiver->ToCreature()->AI()->sQuestAccept(this, quest);
436 break;
437 case TYPEID_ITEM:
438 case TYPEID_CONTAINER:
439 {
440 Item* item = (Item*)questGiver;
441 sScriptMgr->OnQuestAccept(this, item, quest);
442
443 // destroy not required for quest finish quest starting item
444 bool destroyItem = true;
445 for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
446 {
447 if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->MaxCount > 0)
448 {
449 destroyItem = false;
450 break;
451 }
452 }
453
454 if (destroyItem)
455 DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
456
457 break;
458 }
460 sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest);
461 questGiver->ToGameObject()->AI()->QuestAccept(this, quest);
462 break;
463 default:
464 break;
465 }
466}
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:37
@ TYPEID_UNIT
Definition ObjectGuid.h:35
@ TYPEID_ITEM
Definition ObjectGuid.h:33
@ TYPEID_CONTAINER
Definition ObjectGuid.h:34
CreatureAI * AI() const
Definition Creature.h:141
virtual bool QuestAccept(Player *, Quest const *)
Definition GameObjectAI.h:57
GameObjectAI * AI() const
Definition GameObject.h:305
TypeID GetTypeId() const
Definition Object.h:128
GameObject * ToGameObject()
Definition Object.h:214
Creature * ToCreature()
Definition Object.h:206
void AddQuest(Quest const *quest, Object *questGiver)
Definition PlayerQuest.cpp:507
void CompleteQuest(uint32 quest_id)
Definition PlayerQuest.cpp:598
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition PlayerStorage.cpp:3023
bool CanCompleteQuest(uint32 quest_id, const QuestStatusData *q_savedStatus=nullptr)
Definition PlayerQuest.cpp:289
virtual void sQuestAccept(Player *, Quest const *)
Definition UnitAI.h:415
int32 MaxCount
Definition ItemTemplate.h:644

References AddQuest(), Creature::AI(), GameObject::AI(), CanCompleteQuest(), CompleteQuest(), DestroyItem(), Item::GetBagSlot(), Object::GetEntry(), Quest::GetQuestId(), Item::GetSlot(), Item::GetTemplate(), Object::GetTypeId(), ItemTemplate::MaxCount, QUEST_ITEM_OBJECTIVES_COUNT, GameObjectAI::QuestAccept(), Quest::RequiredItemId, UnitAI::sQuestAccept(), sScriptMgr, Object::ToCreature(), Object::ToGameObject(), TYPEID_CONTAINER, TYPEID_GAMEOBJECT, TYPEID_ITEM, and TYPEID_UNIT.

Referenced by Spell::EffectQuestStart(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), and SendPreparedQuest().

◆ AddReceivedSpectatorResetFor()

void Player::AddReceivedSpectatorResetFor ( ObjectGuid  guid)
inline
2601{ m_receivedSpectatorResetFor.insert(guid); }
GuidSet m_receivedSpectatorResetFor
Definition Player.h:2605

References m_receivedSpectatorResetFor.

Referenced by ArenaSpectator::HandleResetCommand().

◆ AddRefundReference()

void Player::AddRefundReference ( ObjectGuid  itemGUID)
15476{
15477 m_refundableItems.insert(itemGUID);
15478}

References m_refundableItems.

Referenced by _LoadItem(), and _StoreOrEquipNewItem().

◆ AddRuneByAuraEffect()

void Player::AddRuneByAuraEffect ( uint8  index,
RuneType  newType,
AuraEffect const *  aura 
)
inline
2536{ SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
void ConvertRune(uint8 index, RuneType newType)
Definition Player.cpp:13383
void SetRuneConvertAura(uint8 index, AuraEffect const *aura)
Definition Player.h:2535

References ConvertRune(), and SetRuneConvertAura().

Referenced by AuraEffect::HandleAuraConvertRune().

◆ AddRunePower()

void Player::AddRunePower ( uint8  index)
13406{
13408 data << uint32(1 << index); // mask (0x00-0x3F probably)
13409 GetSession()->SendPacket(&data);
13410}
@ SMSG_ADD_RUNE_POWER
Definition Opcodes.h:1190

References GetSession(), WorldSession::SendPacket(), and SMSG_ADD_RUNE_POWER.

◆ addSpell()

bool Player::addSpell ( uint32  spellId,
uint8  addSpecMask,
bool  updateActive,
bool  temporary = false,
bool  learnFromSkill = false 
)
3063{
3064 if (!_addSpell(spellId, addSpecMask, temporary, learnFromSkill))
3065 return false;
3066
3067 if (!updateActive)
3068 return true;
3069
3070 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); // must exist, checked in _addSpell
3071
3072 // pussywizard: now update active state for all ranks of this spell! and send packet to swap on action bar
3073 // pussywizard: assumption - it's in all specs, can't be a talent
3074 if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
3075 {
3076 SpellInfo const* nextSpellInfo = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(spellInfo->Id));
3077 while (nextSpellInfo)
3078 {
3079 PlayerSpellMap::iterator itr = m_spells.find(nextSpellInfo->Id);
3080 if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active)
3081 {
3082 if (nextSpellInfo->GetRank() < spellInfo->GetRank())
3083 {
3084 itr->second->Active = false;
3085 if (IsInWorld())
3086 {
3088 data << uint32(nextSpellInfo->Id);
3089 data << uint32(spellInfo->Id);
3090 GetSession()->SendPacket(&data);
3091 }
3092 return false;
3093 }
3094 else if (nextSpellInfo->GetRank() > spellInfo->GetRank())
3095 {
3096 PlayerSpellMap::iterator itr2 = m_spells.find(spellInfo->Id);
3097 if (itr2 != m_spells.end())
3098 itr2->second->Active = false;
3099 return false;
3100 }
3101 }
3102 nextSpellInfo = nextSpellInfo->GetNextRankSpell();
3103 }
3104 }
3105
3106 return true;
3107}
uint8 GetRank() const
Definition SpellInfo.cpp:2506
bool IsRanked() const
Definition SpellInfo.cpp:2501
bool IsStackableWithRanks() const
Definition SpellInfo.cpp:1145
SpellInfo const * GetNextRankSpell() const
Definition SpellInfo.cpp:2525
@ SMSG_SUPERCEDED_SPELL
Definition Opcodes.h:330

References _addSpell(), SpellInfo::GetNextRankSpell(), SpellInfo::GetRank(), GetSession(), SpellInfo::Id, Object::IsInWorld(), SpellInfo::IsRanked(), SpellInfo::IsStackableWithRanks(), m_spells, PLAYERSPELL_REMOVED, WorldSession::SendPacket(), SMSG_SUPERCEDED_SPELL, and sSpellMgr.

Referenced by _LoadSpells(), LearnCustomSpells(), learnSkillRewardedSpells(), and learnSpell().

◆ AddSpellAndCategoryCooldowns()

void Player::AddSpellAndCategoryCooldowns ( SpellInfo const *  spellInfo,
uint32  itemId,
Spell spell = nullptr,
bool  infinityCooldown = false 
)
10889{
10890 // init cooldown values
10891 uint32 cat = 0;
10892 int32 rec = -1;
10893 int32 catrec = -1;
10894
10895 // some special item spells without correct cooldown in SpellInfo
10896 // cooldown information stored in item prototype
10897 // This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client.
10898
10899 if (itemId)
10900 {
10901 if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId))
10902 {
10903 for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
10904 {
10905 if (uint32(proto->Spells[idx].SpellId) == spellInfo->Id)
10906 {
10907 cat = proto->Spells[idx].SpellCategory;
10908 rec = proto->Spells[idx].SpellCooldown;
10909 catrec = proto->Spells[idx].SpellCategoryCooldown;
10910 break;
10911 }
10912 }
10913 }
10914 }
10915
10916 // if no cooldown found above then base at DBC data
10917 if (rec < 0 && catrec < 0)
10918 {
10919 cat = spellInfo->GetCategory();
10920 rec = spellInfo->RecoveryTime;
10921 catrec = spellInfo->CategoryRecoveryTime;
10922 }
10923
10924 time_t catrecTime;
10925 time_t recTime;
10926
10927 bool needsCooldownPacket = false;
10928
10929 // overwrite time for selected category
10930 if (infinityCooldown)
10931 {
10932 // use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped)
10933 // but not allow ignore until reset or re-login
10934 catrecTime = catrec > 0 ? infinityCooldownDelay : 0;
10935 recTime = rec > 0 ? infinityCooldownDelay : catrecTime;
10936 }
10937 else
10938 {
10939 // shoot spells used equipped item cooldown values already assigned in GetAttackTime(RANGED_ATTACK)
10940 // prevent 0 cooldowns set by another way
10941 if (rec <= 0 && catrec <= 0 && (cat == 76 || (spellInfo->IsAutoRepeatRangedSpell() && spellInfo->Id != 75)))
10943
10944 // Now we have cooldown data (if found any), time to apply mods
10945 if (rec > 0)
10946 ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell);
10947
10948 if (catrec > 0 && !spellInfo->HasAttribute(SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS))
10949 {
10950 ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, catrec, spell);
10951 }
10952
10954 {
10955 // Apply SPELL_AURA_MOD_COOLDOWN only to own spells
10956 if (HasSpell(spellInfo->Id))
10957 {
10958 needsCooldownPacket = true;
10959 rec += cooldownMod * IN_MILLISECONDS; // SPELL_AURA_MOD_COOLDOWN does not affect category cooldows, verified with shaman shocks
10960 }
10961 }
10962
10963 // replace negative cooldowns by 0
10964 if (rec < 0) rec = 0;
10965 if (catrec < 0) catrec = 0;
10966
10967 // no cooldown after applying spell mods
10968 if (rec == 0 && catrec == 0)
10969 return;
10970
10971 catrecTime = catrec ? catrec : 0;
10972 recTime = rec ? rec : catrecTime;
10973 }
10974
10975 // category spells
10976 if (cat && catrec > 0)
10977 {
10978 _AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
10979 if (needsCooldownPacket)
10980 {
10981 WorldPacket data;
10982 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, recTime);
10983 SendDirectMessage(&data);
10984 }
10985
10986 PacketCooldowns forcedCategoryCooldowns;
10987
10988 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
10989 if (i_scstore != sSpellsByCategoryStore.end())
10990 {
10991 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
10992 {
10993 if (i_scset->second == spellInfo->Id) // skip main spell, already handled above
10994 {
10995 continue;
10996 }
10997
10998 // If spell category is applied by item, then other spells should be exists in item templates
10999 if ((itemId > 0) != i_scset->first)
11000 {
11001 continue;
11002 }
11003
11004 // Only within the same spellfamily
11005 SpellInfo const* categorySpellInfo = sSpellMgr->GetSpellInfo(i_scset->second);
11006 if (!categorySpellInfo || categorySpellInfo->SpellFamilyName != spellInfo->SpellFamilyName)
11007 {
11008 continue;
11009 }
11010
11011 _AddSpellCooldown(i_scset->second, cat, itemId, catrecTime, !spellInfo->IsCooldownStartedOnEvent() && catrec && rec && catrec != rec);
11012
11013 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS))
11014 {
11015 forcedCategoryCooldowns[i_scset->second] = catrecTime;
11016 }
11017 }
11018 }
11019
11020 if (!forcedCategoryCooldowns.empty())
11021 {
11022 WorldPacket data;
11023 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, forcedCategoryCooldowns);
11024 SendDirectMessage(&data);
11025 }
11026 }
11027 else
11028 {
11029 // self spell cooldown
11030 if (recTime > 0)
11031 {
11032 _AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
11033
11034 if (needsCooldownPacket)
11035 {
11036 WorldPacket data;
11037 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, rec);
11038 SendDirectMessage(&data);
11039 }
11040 }
11041 }
11042}
SpellCategoryStore sSpellsByCategoryStore
Definition DBCStores.cpp:152
#define MAX_ITEM_SPELLS
Definition Item.h:215
@ SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS
Definition SharedDefines.h:635
@ SPELL_AURA_MOD_COOLDOWN
Definition SpellAuraDefines.h:259
@ SPELLMOD_COOLDOWN
Definition SpellDefines.h:87
@ SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS
Definition SpellInfo.h:204
static constexpr uint32 infinityCooldownDelay
Definition Unit.h:47
@ SPELL_COOLDOWN_FLAG_NONE
Definition Unit.h:606
std::unordered_map< uint32, uint32 > PacketCooldowns
Definition Unit.h:611
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5725
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition Player.cpp:9772
uint32 SpellFamilyName
Definition SpellInfo.h:387
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition Unit.cpp:20844
uint32 GetAttackTime(WeaponAttackType att) const
Definition Unit.h:859
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:5997

References _AddSpellCooldown(), ApplySpellMod(), Unit::BuildCooldownPacket(), SpellInfo::CategoryRecoveryTime, Unit::GetAttackTime(), SpellInfo::GetCategory(), Unit::GetTotalAuraModifier(), SpellInfo::HasAttribute(), HasSpell(), SpellInfo::Id, IN_MILLISECONDS, infinityCooldownDelay, SpellInfo::IsAutoRepeatRangedSpell(), SpellInfo::IsCooldownStartedOnEvent(), MAX_ITEM_SPELLS, RANGED_ATTACK, SpellInfo::RecoveryTime, SendDirectMessage(), sObjectMgr, SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS, SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS, SPELL_AURA_MOD_COOLDOWN, SPELL_COOLDOWN_FLAG_NONE, SpellInfo::SpellFamilyName, SPELLMOD_COOLDOWN, sSpellMgr, and sSpellsByCategoryStore.

Referenced by Aura::_ApplyForTarget(), Unit::AddGameObject(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), SendCooldownEvent(), Spell::SendSpellCooldown(), and Unit::SetMinion().

◆ AddSpellCooldown()

void Player::AddSpellCooldown ( uint32  spell_id,
uint32  itemid,
uint32  end_time,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
overridevirtual

◆ AddSpellMod()

void Player::AddSpellMod ( SpellModifier mod,
bool  apply 
)
9870{
9871 LOG_DEBUG("spells.aura", "Player::AddSpellMod {}", mod->spellId);
9873
9874 int i = 0;
9875 flag96 _mask = 0;
9876 for (int eff = 0; eff < 96; ++eff)
9877 {
9878 if (eff != 0 && eff % 32 == 0)
9879 _mask[i++] = 0;
9880
9881 _mask[i] = uint32(1) << (eff - (32 * i));
9882 if (mod->mask & _mask)
9883 {
9884 int32 val = 0;
9885 for (SpellModList::iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr)
9886 {
9887 if ((*itr)->type == mod->type && (*itr)->mask & _mask)
9888 val += (*itr)->value;
9889 }
9890 val += apply ? mod->value : -(mod->value);
9891 WorldPacket data(Opcode, (1 + 1 + 4));
9892 data << uint8(eff);
9893 data << uint8(mod->op);
9894 data << int32(val);
9895 SendDirectMessage(&data);
9896 }
9897 }
9898
9899 if (apply)
9900 {
9901 m_spellMods[mod->op].push_back(mod);
9902 m_spellMods[mod->op].sort(SpellModPredicate());
9903 }
9904 else
9905 {
9906 m_spellMods[mod->op].remove(mod);
9907 // mods bound to aura will be removed in AuraEffect::~AuraEffect
9908 if (!mod->ownerAura)
9909 delete mod;
9910 }
9911}
@ SPELLMOD_FLAT
Definition Player.h:93
SpellModList m_spellMods[MAX_SPELLMOD]
Definition Player.h:2850
Definition Util.h:451
@ SMSG_SET_FLAT_SPELL_MODIFIER
Definition Opcodes.h:644
@ SMSG_SET_PCT_SPELL_MODIFIER
Definition Opcodes.h:645
void apply(T *val)
Definition ByteConverter.h:40
Definition Player.cpp:9860
SpellModOp op
Definition Player.h:183
SpellModType type
Definition Player.h:184
int32 value
Definition Player.h:186
uint32 spellId
Definition Player.h:188
Aura *const ownerAura
Definition Player.h:189
flag96 mask
Definition Player.h:187

References LOG_DEBUG, m_spellMods, SpellModifier::mask, SpellModifier::op, SpellModifier::ownerAura, SendDirectMessage(), SMSG_SET_FLAT_SPELL_MODIFIER, SMSG_SET_PCT_SPELL_MODIFIER, SpellModifier::spellId, SPELLMOD_FLAT, SpellModifier::type, and SpellModifier::value.

Referenced by AuraEffect::ApplySpellMod().

◆ addTalent()

bool Player::addTalent ( uint32  spellId,
uint8  addSpecMask,
uint8  oldTalentRank 
)
2912{
2913 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2914 if (!SpellMgr::CheckSpellValid(spellInfo, spellId, true))
2915 return false;
2916
2917 TalentSpellPos const* talentPos = GetTalentSpellPos(spellId);
2918 if (!talentPos)
2919 return false;
2920
2921 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id);
2922 if (!talentInfo)
2923 return false;
2924
2925 // xinef: remove old talent rank if any
2926 if (oldTalentRank)
2927 {
2928 _removeTalent(talentInfo->RankID[oldTalentRank - 1], addSpecMask);
2929 _removeTalentAurasAndSpells(talentInfo->RankID[oldTalentRank - 1]);
2930 SendLearnPacket(talentInfo->RankID[oldTalentRank - 1], false);
2931 }
2932
2933 // xinef: add talent auras and spells
2934 if (GetActiveSpecMask() & addSpecMask)
2935 _addTalentAurasAndSpells(spellId);
2936
2937 // xinef: find the spell on our talent map
2938 PlayerTalentMap::iterator itr = m_talents.find(spellId);
2939
2940 // xinef: we do not have such a spell on our talent map
2941 if (itr == m_talents.end())
2942 {
2944 PlayerTalent* newTalent = new PlayerTalent();
2945 newTalent->State = state;
2946 newTalent->specMask = addSpecMask;
2947 newTalent->talentID = talentInfo->TalentID;
2948 newTalent->inSpellBook = talentInfo->addToSpellBook && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL);
2949 m_talents[spellId] = newTalent;
2950
2951 if (GetActiveSpecMask() & addSpecMask)
2952 m_usedTalentCount += (talentPos->rank + 1) - oldTalentRank;
2953
2954 return true;
2955 }
2956 // xinef: if current mask does not cover addMask, add it to iterator and save changes to DB
2957 else if (!(itr->second->specMask & addSpecMask))
2958 {
2959 itr->second->specMask |= addSpecMask;
2960 if (itr->second->State != PLAYERSPELL_NEW)
2961 itr->second->State = PLAYERSPELL_CHANGED;
2962
2963 if (GetActiveSpecMask() & addSpecMask)
2964 m_usedTalentCount += (talentPos->rank + 1) - oldTalentRank;
2965
2966 return true;
2967 }
2968
2969 return false;
2970}
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
PlayerSpellState
Definition Player.h:118
Definition Player.h:135
PlayerSpellState State
Definition Player.h:136
bool inSpellBook
Definition Player.h:139
uint32 talentID
Definition Player.h:138
uint8 specMask
Definition Player.h:137
Definition DBCStructure.h:1924
std::array< uint32, MAX_TALENT_RANK > RankID
Definition DBCStructure.h:1929
uint32 TalentID
Definition DBCStructure.h:1925
uint32 addToSpellBook
Definition DBCStructure.h:1935
uint16 talent_id
Definition DBCStructure.h:2237

References _addTalentAurasAndSpells(), _removeTalent(), _removeTalentAurasAndSpells(), TalentEntry::addToSpellBook, SpellMgr::CheckSpellValid(), GetActiveSpecMask(), GetTalentSpellPos(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), PlayerTalent::inSpellBook, isBeingLoaded(), m_talents, m_usedTalentCount, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_UNCHANGED, TalentSpellPos::rank, TalentEntry::RankID, SendLearnPacket(), PlayerTalent::specMask, SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sSpellMgr, sTalentStore, PlayerTalent::State, TalentSpellPos::talent_id, PlayerTalent::talentID, and TalentEntry::TalentID.

Referenced by _LoadTalents(), and LearnTalent().

◆ AddTimedQuest()

void Player::AddTimedQuest ( uint32  quest_id)
inline
1570{ m_timedquests.insert(quest_id); }
QuestSet m_timedquests
Definition Player.h:2713

References m_timedquests.

Referenced by _LoadQuestStatus(), and AddQuest().

◆ AddToWorld()

void Player::AddToWorld ( )
overridevirtual
  • Do not add/remove the player from the object storage
  • It will crash when updating the ObjectAccessor
  • The player should only be added when logging in

Reimplemented from Object.

1714{
1719
1720 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
1721 if (m_items[i])
1722 m_items[i]->AddToWorld();
1723}
@ PLAYER_SLOT_START
Definition Player.h:671
@ PLAYER_SLOT_END
Definition Player.h:673
void AddToWorld() override
Definition Unit.cpp:15766

References Object::AddToWorld(), Unit::AddToWorld(), m_items, PLAYER_SLOT_END, and PLAYER_SLOT_START.

Referenced by Map::AddPlayerToMap().

◆ AddTradeableItem()

void Player::AddTradeableItem ( Item item)
4133{
4134 std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
4135 m_itemSoulboundTradeable.push_back(item);
4136}
std::mutex m_soulboundTradableLock
Definition Player.h:2857
ItemDurationList m_itemSoulboundTradeable
Definition Player.h:2856

References m_itemSoulboundTradeable, and m_soulboundTradableLock.

Referenced by _LoadItem(), MoveItemToInventory(), and StoreNewItem().

◆ AddWeaponProficiency()

void Player::AddWeaponProficiency ( uint32  newflag)
inline
1374{ m_WeaponProficiency |= newflag; }

References m_WeaponProficiency.

Referenced by Spell::EffectProficiency().

◆ AddWhisperWhiteList()

void Player::AddWhisperWhiteList ( ObjectGuid  guid)
inline
2576{ WhisperList.push_back(guid); }
WhisperListContainer WhisperList
Definition Player.h:2667

References WhisperList.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ AdjustQuestReqItemCount()

void Player::AdjustQuestReqItemCount ( Quest const *  quest,
QuestStatusData questStatusData 
)
private
1765{
1766 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
1767 {
1768 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
1769 {
1770 uint32 reqitemcount = quest->RequiredItemCount[i];
1771 if (reqitemcount != 0)
1772 {
1773 uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true);
1774
1775 questStatusData.ItemCount[i] = std::min(curitemcount, reqitemcount);
1776 m_QuestStatusSave[quest->GetQuestId()] = true;
1777 }
1778 }
1779 }
1780}
uint32 GetItemCount(uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
Definition PlayerStorage.cpp:327

References GetItemCount(), Quest::GetQuestId(), Quest::HasSpecialFlag(), QuestStatusData::ItemCount, m_QuestStatusSave, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, and Quest::RequiredItemId.

Referenced by AddQuest().

◆ ApplyEnchantment() [1/2]

void Player::ApplyEnchantment ( Item item,
bool  apply 
)
4299{
4300 for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
4301 ApplyEnchantment(item, EnchantmentSlot(slot), apply);
4302}

References ApplyEnchantment(), and MAX_ENCHANTMENT_SLOT.

◆ ApplyEnchantment() [2/2]

void Player::ApplyEnchantment ( Item item,
EnchantmentSlot  slot,
bool  apply,
bool  apply_dur = true,
bool  ignore_condition = false 
)
Deprecated:
item mods
4305{
4306 if (!item || !item->IsEquipped())
4307 return;
4308
4309 if (slot >= MAX_ENCHANTMENT_SLOT)
4310 return;
4311
4312 uint32 enchant_id = item->GetEnchantmentId(slot);
4313 if (!enchant_id)
4314 return;
4315
4316 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
4317 if (!pEnchant)
4318 return;
4319
4320 if (!ignore_condition && pEnchant->EnchantmentCondition && !EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
4321 return;
4322
4323 if (pEnchant->requiredLevel > GetLevel())
4324 return;
4325
4326 if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
4327 return;
4328
4329 if (!sScriptMgr->OnPlayerCanApplyEnchantment(this, item, slot, apply, apply_dur, ignore_condition))
4330 return;
4331
4332 // If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
4333 // rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
4335 && !item->GetTemplate()->Socket[slot - SOCK_ENCHANTMENT_SLOT].Color)
4336 {
4337 // Check if the requirements for the prismatic socket are met before applying the gem stats
4339 if (!pPrismaticEnchant || (pPrismaticEnchant->requiredSkill > 0 && pPrismaticEnchant->requiredSkillValue > GetSkillValue(pPrismaticEnchant->requiredSkill)))
4340 return;
4341 }
4342
4343 if (!item->IsBroken())
4344 {
4345 for (int s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
4346 {
4347 uint32 enchant_display_type = pEnchant->type[s];
4348 uint32 enchant_amount = pEnchant->amount[s];
4349 uint32 enchant_spell_id = pEnchant->spellid[s];
4350
4351 switch (enchant_display_type)
4352 {
4354 break;
4356 // processed in Player::CastItemCombatSpell
4357 break;
4359 if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
4360 HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply);
4361 else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
4362 HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(enchant_amount), apply);
4363 else if (item->GetSlot() == EQUIPMENT_SLOT_RANGED)
4364 HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4365 break;
4367 if (enchant_spell_id)
4368 {
4369 if (apply)
4370 {
4371 int32 basepoints = 0;
4372 // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor)
4373 if (item->GetItemRandomPropertyId())
4374 {
4375 ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4376 if (item_rand)
4377 {
4378 // Search enchant_amount
4379 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4380 {
4381 if (item_rand->Enchantment[k] == enchant_id)
4382 {
4383 basepoints = int32((item_rand->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4384 break;
4385 }
4386 }
4387 }
4388 }
4389 // Cast custom spell vs all equal basepoints got from enchant_amount
4390 if (basepoints)
4391 CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item);
4392 else
4393 CastSpell(this, enchant_spell_id, true, item);
4394 }
4395 else
4396 RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID());
4397 }
4398 break;
4400 if (!enchant_amount)
4401 {
4402 ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4403 if (item_rand)
4404 {
4405 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4406 {
4407 if (item_rand->Enchantment[k] == enchant_id)
4408 {
4409 enchant_amount = uint32((item_rand->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4410 break;
4411 }
4412 }
4413 }
4414 }
4415
4416 HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + enchant_spell_id), TOTAL_VALUE, float(enchant_amount), apply);
4417 break;
4419 {
4420 if (!enchant_amount)
4421 {
4422 ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4423 if (item_rand_suffix)
4424 {
4425 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4426 {
4427 if (item_rand_suffix->Enchantment[k] == enchant_id)
4428 {
4429 enchant_amount = uint32((item_rand_suffix->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4430 break;
4431 }
4432 }
4433 }
4434 }
4435
4436 sScriptMgr->OnPlayerApplyEnchantmentItemModsBefore(this, item, slot, apply, enchant_spell_id, enchant_amount);
4437
4438 LOG_DEBUG("entities.player.items", "Adding {} to stat nb {}", enchant_amount, enchant_spell_id);
4439 switch (enchant_spell_id)
4440 {
4441 case ITEM_MOD_MANA:
4442 LOG_DEBUG("entities.player.items", "+ {} MANA", enchant_amount);
4443 HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(enchant_amount), apply);
4444 break;
4445 case ITEM_MOD_HEALTH:
4446 LOG_DEBUG("entities.player.items", "+ {} HEALTH", enchant_amount);
4447 HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(enchant_amount), apply);
4448 break;
4449 case ITEM_MOD_AGILITY:
4450 LOG_DEBUG("entities.player.items", "+ {} AGILITY", enchant_amount);
4451 HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply);
4452 ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply);
4453 break;
4454 case ITEM_MOD_STRENGTH:
4455 LOG_DEBUG("entities.player.items", "+ {} STRENGTH", enchant_amount);
4456 HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply);
4457 ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply);
4458 break;
4459 case ITEM_MOD_INTELLECT:
4460 LOG_DEBUG("entities.player.items", "+ {} INTELLECT", enchant_amount);
4461 HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply);
4462 ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply);
4463 break;
4464 case ITEM_MOD_SPIRIT:
4465 LOG_DEBUG("entities.player.items", "+ {} SPIRIT", enchant_amount);
4466 HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply);
4467 ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply);
4468 break;
4469 case ITEM_MOD_STAMINA:
4470 LOG_DEBUG("entities.player.items", "+ {} STAMINA", enchant_amount);
4471 HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply);
4472 ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply);
4473 break;
4475 ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
4476 LOG_DEBUG("entities.player.items", "+ {} DEFENCE", enchant_amount);
4477 break;
4479 ApplyRatingMod(CR_DODGE, enchant_amount, apply);
4480 LOG_DEBUG("entities.player.items", "+ {} DODGE", enchant_amount);
4481 break;
4483 ApplyRatingMod(CR_PARRY, enchant_amount, apply);
4484 LOG_DEBUG("entities.player.items", "+ {} PARRY", enchant_amount);
4485 break;
4487 ApplyRatingMod(CR_BLOCK, enchant_amount, apply);
4488 LOG_DEBUG("entities.player.items", "+ {} SHIELD_BLOCK", enchant_amount);
4489 break;
4491 ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
4492 LOG_DEBUG("entities.player.items", "+ {} MELEE_HIT", enchant_amount);
4493 break;
4495 ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
4496 LOG_DEBUG("entities.player.items", "+ {} RANGED_HIT", enchant_amount);
4497 break;
4499 ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
4500 LOG_DEBUG("entities.player.items", "+ {} SPELL_HIT", enchant_amount);
4501 break;
4503 ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
4504 LOG_DEBUG("entities.player.items", "+ {} MELEE_CRIT", enchant_amount);
4505 break;
4507 ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
4508 LOG_DEBUG("entities.player.items", "+ {} RANGED_CRIT", enchant_amount);
4509 break;
4511 ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
4512 LOG_DEBUG("entities.player.items", "+ {} SPELL_CRIT", enchant_amount);
4513 break;
4514 // Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
4515 // in Enchantments
4516 // case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
4517 // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
4518 // break;
4519 // case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
4520 // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
4521 // break;
4522 // case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
4523 // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
4524 // break;
4525 // case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
4526 // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4527 // break;
4528 // case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
4529 // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4530 // break;
4531 // case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
4532 // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4533 // break;
4534 // case ITEM_MOD_HASTE_MELEE_RATING:
4535 // ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
4536 // break;
4538 ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
4539 break;
4541 ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
4542 break;
4544 ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
4545 ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
4546 ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
4547 LOG_DEBUG("entities.player.items", "+ {} HIT", enchant_amount);
4548 break;
4550 ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
4551 ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
4552 ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
4553 LOG_DEBUG("entities.player.items", "+ {} CRITICAL", enchant_amount);
4554 break;
4555 // Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment
4556 // case ITEM_MOD_HIT_TAKEN_RATING:
4557 // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
4558 // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
4559 // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
4560 // break;
4561 // case ITEM_MOD_CRIT_TAKEN_RATING:
4562 // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4563 // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4564 // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4565 // break;
4567 ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4568 ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4569 ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4570 LOG_DEBUG("entities.player.items", "+ {} RESILIENCE", enchant_amount);
4571 break;
4573 ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
4574 ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
4575 ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
4576 LOG_DEBUG("entities.player.items", "+ {} HASTE", enchant_amount);
4577 break;
4579 ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
4580 LOG_DEBUG("entities.player.items", "+ {} EXPERTISE", enchant_amount);
4581 break;
4583 HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply);
4584 HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4585 LOG_DEBUG("entities.player.items", "+ {} ATTACK_POWER", enchant_amount);
4586 break;
4588 HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4589 LOG_DEBUG("entities.player.items", "+ {} RANGED_ATTACK_POWER", enchant_amount);
4590 break;
4591 // case ITEM_MOD_FERAL_ATTACK_POWER:
4592 // ApplyFeralAPBonus(enchant_amount, apply);
4593 // LOG_DEBUG("entities.player.items", "+ {} FERAL_ATTACK_POWER", enchant_amount);
4594 // break;
4596 ApplyManaRegenBonus(enchant_amount, apply);
4597 LOG_DEBUG("entities.player.items", "+ {} MANA_REGENERATION", enchant_amount);
4598 break;
4600 ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply);
4601 LOG_DEBUG("entities.player.items", "+ {} ARMOR PENETRATION", enchant_amount);
4602 break;
4604 ApplySpellPowerBonus(enchant_amount, apply);
4605 LOG_DEBUG("entities.player.items", "+ {} SPELL_POWER", enchant_amount);
4606 break;
4608 ApplyHealthRegenBonus(enchant_amount, apply);
4609 LOG_DEBUG("entities.player.items", "+ {} HEALTH_REGENERATION", enchant_amount);
4610 break;
4612 ApplySpellPenetrationBonus(enchant_amount, apply);
4613 LOG_DEBUG("entities.player.items", "+ {} SPELL_PENETRATION", enchant_amount);
4614 break;
4616 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(enchant_amount), apply);
4617 LOG_DEBUG("entities.player.items", "+ {} BLOCK_VALUE", enchant_amount);
4618 break;
4621 ApplySpellHealingBonus(enchant_amount, apply);
4622 LOG_DEBUG("entities.player.items", "+ {} SPELL_HEALING", enchant_amount);
4623 break;
4625 ApplySpellDamageBonus(enchant_amount, apply);
4626 LOG_DEBUG("entities.player.items", "+ {} SPELL_DAMAGE", enchant_amount);
4627 break;
4628 default:
4629 break;
4630 }
4631 break;
4632 }
4633 case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon
4634 {
4636 {
4637 float addValue = 0.0f;
4638 if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
4639 {
4640 addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
4642 }
4643 else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
4644 {
4645 addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
4647 }
4648 }
4649 break;
4650 }
4652 // processed in Player::CastItemUseSpell
4653 break;
4655 // nothing do..
4656 break;
4657 default:
4658 LOG_ERROR("entities.player", "Unknown item enchantment (id = {}) display type: {}", enchant_id, enchant_display_type);
4659 break;
4660 } /*switch (enchant_display_type)*/
4661 } /*for*/
4662 }
4663
4664 // visualize enchantment at player and equipped items
4665 if (slot == PERM_ENCHANTMENT_SLOT)
4666 SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 0, apply ? item->GetEnchantmentId(slot) : 0);
4667
4668 if (slot == TEMP_ENCHANTMENT_SLOT)
4669 SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 1, apply ? item->GetEnchantmentId(slot) : 0);
4670
4671 if (apply_dur)
4672 {
4673 if (apply)
4674 {
4675 // set duration
4676 uint32 duration = item->GetEnchantmentDuration(slot);
4677 if (duration > 0)
4678 AddEnchantmentDuration(item, slot, duration);
4679 }
4680 else
4681 {
4682 // duration == 0 will remove EnchantDuration
4683 AddEnchantmentDuration(item, slot, 0);
4684 }
4685 }
4686}
@ ITEM_ENCHANTMENT_TYPE_DAMAGE
Definition DBCEnums.h:368
@ ITEM_ENCHANTMENT_TYPE_USE_SPELL
Definition DBCEnums.h:373
@ ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL
Definition DBCEnums.h:367
@ ITEM_ENCHANTMENT_TYPE_STAT
Definition DBCEnums.h:371
@ ITEM_ENCHANTMENT_TYPE_RESISTANCE
Definition DBCEnums.h:370
@ ITEM_ENCHANTMENT_TYPE_NONE
Definition DBCEnums.h:366
@ ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL
Definition DBCEnums.h:369
@ ITEM_ENCHANTMENT_TYPE_TOTEM
Definition DBCEnums.h:372
@ ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET
Definition DBCEnums.h:374
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1839
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition DBCStructure.h:1205
@ PERM_ENCHANTMENT_SLOT
Definition Item.h:169
@ SOCK_ENCHANTMENT_SLOT_3
Definition Item.h:173
@ TEMP_ENCHANTMENT_SLOT
Definition Item.h:170
@ SOCK_ENCHANTMENT_SLOT_2
Definition Item.h:172
@ PRISMATIC_ENCHANTMENT_SLOT
Definition Item.h:175
@ SOCK_ENCHANTMENT_SLOT
Definition Item.h:171
@ CLASS_SHAMAN
Definition SharedDefines.h:147
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:173
@ PLAYER_VISIBLE_ITEM_1_ENCHANTMENT
Definition UpdateFields.h:287
int32 GetItemRandomPropertyId() const
Definition Item.h:295
uint32 GetItemSuffixFactor() const
Definition Item.h:296
bool IsEquipped() const
Definition Item.cpp:789
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:759
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5483
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
Definition Player.cpp:11100
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1250
void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid)
Definition Unit.cpp:5141
Definition DBCStructure.h:1218
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition DBCStructure.h:1225
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition DBCStructure.h:1223
uint32 Delay
Definition ItemTemplate.h:659
_Socket Socket[MAX_ITEM_PROTO_SOCKETS]
Definition ItemTemplate.h:681
Definition DBCStructure.h:1842
uint32 EnchantmentCondition
Definition DBCStructure.h:1854
uint32 amount[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1846
uint32 requiredLevel
Definition DBCStructure.h:1857
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1848
uint32 requiredSkill
Definition DBCStructure.h:1855
uint32 requiredSkillValue
Definition DBCStructure.h:1856
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1845
uint32 Color
Definition ItemTemplate.h:602

References AddEnchantmentDuration(), ItemRandomSuffixEntry::AllocationPct, SpellItemEnchantmentEntry::amount, ApplyHealthRegenBonus(), ApplyManaRegenBonus(), ApplyRatingMod(), ApplySpellDamageBonus(), ApplySpellHealingBonus(), ApplySpellPenetrationBonus(), ApplySpellPowerBonus(), Unit::ApplyStatBuffMod(), BASE_VALUE, Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_SHAMAN, _Socket::Color, CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_PARRY, ItemTemplate::Delay, ItemRandomSuffixEntry::Enchantment, SpellItemEnchantmentEntry::EnchantmentCondition, EnchantmentFitsRequirements(), EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, FLAT_MOD, Item::GetEnchantmentDuration(), Item::GetEnchantmentId(), Object::GetGUID(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), Unit::GetLevel(), GetSkillValue(), Item::GetSlot(), Item::GetTemplate(), HandleBaseModValue(), Unit::HandleStatModifier(), Item::IsBroken(), IsClass(), Item::IsEquipped(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, ITEM_ENCHANTMENT_TYPE_DAMAGE, ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL, ITEM_ENCHANTMENT_TYPE_NONE, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET, ITEM_ENCHANTMENT_TYPE_RESISTANCE, ITEM_ENCHANTMENT_TYPE_STAT, ITEM_ENCHANTMENT_TYPE_TOTEM, ITEM_ENCHANTMENT_TYPE_USE_SPELL, ITEM_MOD_AGILITY, ITEM_MOD_ARMOR_PENETRATION_RATING, ITEM_MOD_ATTACK_POWER, ITEM_MOD_BLOCK_RATING, ITEM_MOD_BLOCK_VALUE, ITEM_MOD_CRIT_MELEE_RATING, ITEM_MOD_CRIT_RANGED_RATING, ITEM_MOD_CRIT_RATING, ITEM_MOD_CRIT_SPELL_RATING, ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_EXPERTISE_RATING, ITEM_MOD_HASTE_RANGED_RATING, ITEM_MOD_HASTE_RATING, ITEM_MOD_HASTE_SPELL_RATING, ITEM_MOD_HEALTH, ITEM_MOD_HEALTH_REGEN, ITEM_MOD_HIT_MELEE_RATING, ITEM_MOD_HIT_RANGED_RATING, ITEM_MOD_HIT_RATING, ITEM_MOD_HIT_SPELL_RATING, ITEM_MOD_INTELLECT, ITEM_MOD_MANA, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_PARRY_RATING, ITEM_MOD_RANGED_ATTACK_POWER, ITEM_MOD_RESILIENCE_RATING, ITEM_MOD_SPELL_DAMAGE_DONE, ITEM_MOD_SPELL_HEALING_DONE, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_SPELL_POWER, ITEM_MOD_SPIRIT, ITEM_MOD_STAMINA, ITEM_MOD_STRENGTH, LOG_DEBUG, LOG_ERROR, MAX_ENCHANTMENT_SLOT, MAX_ITEM_ENCHANTMENT_EFFECTS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, PERM_ENCHANTMENT_SLOT, PLAYER_VISIBLE_ITEM_1_ENCHANTMENT, PRISMATIC_ENCHANTMENT_SLOT, Unit::RemoveAurasDueToItemSpell(), SpellItemEnchantmentEntry::requiredLevel, SpellItemEnchantmentEntry::requiredSkill, SpellItemEnchantmentEntry::requiredSkillValue, Object::SetUInt16Value(), SHIELD_BLOCK_VALUE, sItemRandomSuffixStore, SOCK_ENCHANTMENT_SLOT, SOCK_ENCHANTMENT_SLOT_2, SOCK_ENCHANTMENT_SLOT_3, ItemTemplate::Socket, SpellItemEnchantmentEntry::spellid, sScriptMgr, sSpellItemEnchantmentStore, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, TEMP_ENCHANTMENT_SLOT, TOTAL_VALUE, SpellItemEnchantmentEntry::type, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RESISTANCE_START, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), ApplyEnchantment(), CastItemCombatSpell(), CorrectMetaGemEnchants(), Spell::EffectEnchantHeldItem(), Spell::EffectEnchantItemPerm(), Spell::EffectEnchantItemPrismatic(), Spell::EffectEnchantItemTmp(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleCancelTempEnchantmentOpcode(), WorldSession::HandleSocketOpcode(), RemoveArenaEnchantments(), SetVirtualItemSlot(), SwapItem(), ToggleMetaGemsActive(), UpdateEnchantTime(), and UpdateSkillEnchantments().

◆ ApplyEquipCooldown()

void Player::ApplyEquipCooldown ( Item pItem)
11741{
11743 return;
11744
11745 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
11746 {
11747 _Spell const& spellData = pItem->GetTemplate()->Spells[i];
11748
11749 // no spell
11750 if (!spellData.SpellId)
11751 continue;
11752
11753 // xinef: apply hidden cooldown for procs
11755 {
11756 // xinef: uint32(-1) special marker for proc cooldowns
11757 AddSpellCooldown(spellData.SpellId, uint32(-1), 30 * IN_MILLISECONDS);
11758 continue;
11759 }
11760
11761 // wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown)
11762 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
11763 continue;
11764
11765 // xinef: dont apply equip cooldown if spell on item has insignificant cooldown
11766 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
11767 if (spellData.SpellCooldown <= 3000 && spellData.SpellCategoryCooldown <= 3000 && (!spellInfo || (spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000)))
11768 continue;
11769
11770 // Don't replace longer cooldowns by equip cooldown if we have any.
11771 SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId);
11772 if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > GameTime::GetGameTimeMS().count() + 30 * IN_MILLISECONDS)
11773 continue;
11774
11775 // xinef: dont apply eqiup cooldown for spells with this attribute
11776 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL))
11777 continue;
11778
11779 AddSpellCooldown(spellData.SpellId, pItem->GetEntry(), 30 * IN_MILLISECONDS, true, true);
11780
11782 data << pItem->GetGUID();
11783 data << uint32(spellData.SpellId);
11784 GetSession()->SendPacket(&data);
11785 }
11786}
@ ITEM_SPELLTRIGGER_ON_USE
Definition ItemTemplate.h:77
@ ITEM_SPELLTRIGGER_ON_EQUIP
Definition ItemTemplate.h:78
@ ITEM_FLAG_NO_EQUIP_COOLDOWN
Definition ItemTemplate.h:154
#define MAX_ITEM_PROTO_SPELLS
Definition ItemTemplate.h:615
@ SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL
Definition SharedDefines.h:410
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11066
uint32 RecoveryTime
Definition SpellInfo.h:348
uint32 CategoryRecoveryTime
Definition SpellInfo.h:349
@ SMSG_ITEM_COOLDOWN
Definition Opcodes.h:206
_Spell Spells[MAX_ITEM_PROTO_SPELLS]
Definition ItemTemplate.h:662
Definition ItemTemplate.h:590
uint32 SpellTrigger
Definition ItemTemplate.h:592
int32 SpellCategoryCooldown
Definition ItemTemplate.h:597
int32 SpellCooldown
Definition ItemTemplate.h:595
int32 SpellId
Definition ItemTemplate.h:591

References AddSpellCooldown(), SpellInfo::CategoryRecoveryTime, Object::GetEntry(), GameTime::GetGameTimeMS(), Object::GetGUID(), GetSession(), Item::GetTemplate(), SpellInfo::HasAttribute(), ItemTemplate::HasFlag(), IN_MILLISECONDS, ITEM_FLAG_NO_EQUIP_COOLDOWN, ITEM_SPELLTRIGGER_ON_EQUIP, ITEM_SPELLTRIGGER_ON_USE, m_spellCooldowns, MAX_ITEM_PROTO_SPELLS, SpellInfo::RecoveryTime, WorldSession::SendPacket(), SMSG_ITEM_COOLDOWN, SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL, _Spell::SpellCategoryCooldown, _Spell::SpellCooldown, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, and sSpellMgr.

Referenced by EquipItem().

◆ ApplyEquipSpell()

void Player::ApplyEquipSpell ( SpellInfo const *  spellInfo,
Item item,
bool  apply,
bool  form_change = false 
)
7175{
7176 if (apply)
7177 {
7178 if (!sScriptMgr->OnPlayerCanApplyEquipSpell(this, spellInfo, item, apply, form_change))
7179 return;
7180
7181 // Cannot be used in this stance/form
7182 if (spellInfo->CheckShapeshift(GetShapeshiftForm()) != SPELL_CAST_OK)
7183 return;
7184
7185 if (form_change) // check aura active state from other form
7186 {
7187 AuraApplicationMapBounds range = GetAppliedAuras().equal_range(spellInfo->Id);
7188 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
7189 if (!item || itr->second->GetBase()->GetCastItemGUID() == item->GetGUID())
7190 return;
7191 }
7192
7193 LOG_DEBUG("entities.player", "WORLD: cast {} Equip spellId - {}", (item ? "item" : "itemset"), spellInfo->Id);
7194
7195 CastSpell(this, spellInfo, true, item);
7196 }
7197 else
7198 {
7199 if (form_change) // check aura compatibility
7200 {
7201 // Cannot be used in this stance/form
7202 if (spellInfo->CheckShapeshift(GetShapeshiftForm()) == SPELL_CAST_OK)
7203 return; // and remove only not compatible at form change
7204 }
7205
7206 if (item)
7207 RemoveAurasDueToItemSpell(spellInfo->Id, item->GetGUID()); // un-apply all spells, not only at-equipped
7208 else
7209 RemoveAurasDueToSpell(spellInfo->Id); // un-apply spell (item set case)
7210 }
7211}
@ SPELL_CAST_OK
Definition SharedDefines.h:1138
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1870
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition Unit.h:630
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1306

References Unit::CastSpell(), SpellInfo::CheckShapeshift(), Unit::GetAppliedAuras(), Object::GetGUID(), Unit::GetShapeshiftForm(), SpellInfo::Id, LOG_DEBUG, Unit::RemoveAurasDueToItemSpell(), Unit::RemoveAurasDueToSpell(), SPELL_CAST_OK, and sScriptMgr.

Referenced by AddItemsSetItem(), ApplyItemEquipSpell(), RemoveItemsSetItem(), and UpdateEquipSpellsAtFormChange().

◆ ApplyFeralAPBonus()

void Player::ApplyFeralAPBonus ( int32  amount,
bool  apply 
)
342{
343 _ModifyUInt32(apply, m_baseFeralAP, amount);
345}
bool _ModifyUInt32(bool apply, uint32 &baseValue, int32 &amount)
Definition StatSystem.cpp:28
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition StatSystem.cpp:347

References _ModifyUInt32(), m_baseFeralAP, and UpdateAttackPowerAndDamage().

Referenced by _ApplyItemBonuses().

◆ ApplyHealthRegenBonus()

void Player::ApplyHealthRegenBonus ( int32  amount,
bool  apply 
)
939{
940 _ModifyUInt32(apply, m_baseHealthRegen, amount);
941}

References _ModifyUInt32(), and m_baseHealthRegen.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplyItemEquipSpell()

void Player::ApplyItemEquipSpell ( Item item,
bool  apply,
bool  form_change = false 
)
7135{
7136 if (!item)
7137 return;
7138
7139 ItemTemplate const* proto = item->GetTemplate();
7140 if (!proto)
7141 return;
7142
7143 for (auto const& spellData : proto->Spells)
7144 {
7145 // no spell
7146 if (!spellData.SpellId)
7147 continue;
7148
7149 // wrong triggering type
7150 if (apply)
7151 {
7152 // Only apply "On Equip" spells
7153 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
7154 continue;
7155 }
7156 else
7157 {
7158 // Do not remove "Use" spells in these special cases:
7159 // 1. During form changes (e.g., druid shapeshifting)
7160 // 2. When the spell comes from an item with negative charges, which means its effect should persist after the item is consumed or removed.
7161 if (spellData.SpellTrigger == ITEM_SPELLTRIGGER_ON_USE && (form_change || spellData.SpellCharges < 0))
7162 continue;
7163 }
7164
7165 // check if it is valid spell
7166 SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(spellData.SpellId);
7167 if (!spellproto)
7168 continue;
7169
7170 ApplyEquipSpell(spellproto, item, apply, form_change);
7171 }
7172}
Spells
Definition BattlegroundIC.h:712
void ApplyEquipSpell(SpellInfo const *spellInfo, Item *item, bool apply, bool form_change=false)
Definition Player.cpp:7174

References ApplyEquipSpell(), Item::GetTemplate(), ITEM_SPELLTRIGGER_ON_EQUIP, ITEM_SPELLTRIGGER_ON_USE, ItemTemplate::Spells, and sSpellMgr.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and UpdateEquipSpellsAtFormChange().

◆ ApplyManaRegenBonus()

void Player::ApplyManaRegenBonus ( int32  amount,
bool  apply 
)
933{
934 _ModifyUInt32(apply, m_baseManaRegen, amount);
936}
void UpdateManaRegen()
Definition StatSystem.cpp:943

References _ModifyUInt32(), m_baseManaRegen, and UpdateManaRegen().

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplyRatingMod()

void Player::ApplyRatingMod ( CombatRating  cr,
int32  value,
bool  apply 
)
5293{
5294 float oldRating = m_baseRatingValue[cr];
5295 m_baseRatingValue[cr] += (apply ? value : -value);
5296 // explicit affected values
5297 if (cr == CR_HASTE_MELEE || cr == CR_HASTE_RANGED || cr == CR_HASTE_SPELL)
5298 {
5299 float const mult = GetRatingMultiplier(cr);
5300 float const oldVal = oldRating * mult;
5301 float const newVal = m_baseRatingValue[cr] * mult;
5302 switch (cr)
5303 {
5304 case CR_HASTE_MELEE:
5305 ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false);
5306 ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
5309 break;
5310 case CR_HASTE_RANGED:
5313 break;
5314 case CR_HASTE_SPELL:
5315 ApplyCastTimePercentMod(oldVal, false);
5316 ApplyCastTimePercentMod(newVal, true);
5317 break;
5318 default:
5319 break;
5320 }
5321 }
5322
5323 UpdateRating(cr);
5324}
float GetRatingMultiplier(CombatRating cr) const
Definition Player.cpp:5215
void UpdateRating(CombatRating cr)
Definition PlayerUpdates.cpp:610
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:17128
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:17144

References Unit::ApplyAttackTimePercentMod(), Unit::ApplyCastTimePercentMod(), BASE_ATTACK, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, GetRatingMultiplier(), m_baseRatingValue, OFF_ATTACK, RANGED_ATTACK, and UpdateRating().

Referenced by _ApplyItemBonuses(), ApplyEnchantment(), AuraEffect::HandleModRating(), AuraEffect::HandleModRatingFromStat(), spell_dru_rejuvenation_moonglade_2_set::OnApply(), spell_dru_rejuvenation_moonglade_2_set::OnRemove(), RecalculateRating(), and UpdateStats().

◆ ApplySpellDamageBonus()

void Player::ApplySpellDamageBonus ( int32  amount,
bool  apply 
)
178{
179 apply = _ModifyUInt32(apply, m_baseSpellDamage, amount);
180
181 // For speed just update for client
182 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
184}
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:284
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:804

References _ModifyUInt32(), Object::ApplyModInt32Value(), m_baseSpellDamage, MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, and SPELL_SCHOOL_HOLY.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplySpellHealingBonus()

void Player::ApplySpellHealingBonus ( int32  amount,
bool  apply 
)
187{
188 apply = _ModifyUInt32(apply, m_baseSpellHealing, amount);
189
190 // For speed just update for client
192}
@ PLAYER_FIELD_MOD_HEALING_DONE_POS
Definition UpdateFields.h:363

References _ModifyUInt32(), Object::ApplyModUInt32Value(), m_baseSpellHealing, and PLAYER_FIELD_MOD_HEALING_DONE_POS.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplySpellMod()

template<class T >
template AC_GAME_API void Player::ApplySpellMod ( uint32  spellId,
SpellModOp  op,
T &  basevalue,
Spell spell = nullptr,
bool  temporaryPet = false 
)
9773{
9774 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
9775 if (!spellInfo)
9776 return;
9777
9778 float totalmul = 1.0f;
9779 int32 totalflat = 0;
9780
9781 auto calculateSpellMod = [&](SpellModifier* mod)
9782 {
9783 // xinef: temporary pets cannot use charged mods of owner, needed for mirror image QQ they should use their own auras
9784 if (temporaryPet && mod->charges != 0)
9785 return;
9786
9787 // skip if already instant or cost is free
9788 if (mod->op == SPELLMOD_CASTING_TIME || mod->op == SPELLMOD_COST)
9789 if (((float)basevalue + (float)basevalue * (totalmul - 1.0f) + (float)totalflat) <= 0)
9790 return;
9791
9792 if (mod->type == SPELLMOD_FLAT)
9793 {
9794 // xinef: do not allow to consume more than one 100% crit increasing spell
9795 if (mod->op == SPELLMOD_CRITICAL_CHANCE && totalflat >= 100)
9796 return;
9797
9798 int32 flatValue = mod->value;
9799
9800 // SPELL_MOD_THREAT - divide by 100 (in packets we send threat * 100)
9801 if (mod->op == SPELLMOD_THREAT)
9802 flatValue /= 100;
9803
9804 totalflat += flatValue;
9805 }
9806 else if (mod->type == SPELLMOD_PCT)
9807 {
9808 // skip percent mods for null basevalue (most important for spell mods with charges)
9809 if (basevalue == T(0) || totalmul == 0.0f)
9810 return;
9811
9812 // special case (skip > 10sec spell casts for instant cast setting)
9813 if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
9814 return;
9815 // xinef: special exception for surge of light, dont affect crit chance if previous mods were not applied
9816 else if (mod->op == SPELLMOD_CRITICAL_CHANCE && spell && !HasSpellMod(mod, spell))
9817 return;
9818 // xinef: special case for backdraft gcd reduce with backlast time reduction, dont affect gcd if cast time was not applied
9819 else if (mod->op == SPELLMOD_GLOBAL_COOLDOWN && spell && !HasSpellMod(mod, spell))
9820 return;
9821
9822 // xinef: those two mods should be multiplicative (Glyph of Renew)
9823 if (mod->op == SPELLMOD_DAMAGE || mod->op == SPELLMOD_DOT)
9824 totalmul *= CalculatePct(1.0f, 100.0f + mod->value);
9825 else
9826 totalmul += CalculatePct(1.0f, mod->value);
9827 }
9828
9829 DropModCharge(mod, spell);
9830 };
9831
9832 // Drop charges for triggering spells instead of triggered ones
9834 spell = m_spellModTakingSpell;
9835
9836 for (auto mod : m_spellMods[op])
9837 {
9838 // Charges can be set only for mods with auras
9839 if (!mod->ownerAura)
9840 ASSERT(!mod->charges);
9841
9842 if (!IsAffectedBySpellmod(spellInfo, mod, spell))
9843 continue;
9844
9845 calculateSpellMod(mod);
9846 }
9847
9848 if (op == SPELLMOD_CASTING_TIME || op == SPELLMOD_DURATION)
9849 basevalue = (basevalue + totalflat) > 0 ? (basevalue + totalflat) * totalmul : 0;
9850 else
9851 basevalue = (basevalue * totalmul) + totalflat;
9852}
@ SPELLMOD_PCT
Definition Player.h:94
@ SPELLMOD_DAMAGE
Definition SpellDefines.h:76
@ SPELLMOD_DOT
Definition SpellDefines.h:98
@ SPELLMOD_CRITICAL_CHANCE
Definition SpellDefines.h:83
@ SPELLMOD_GLOBAL_COOLDOWN
Definition SpellDefines.h:97
@ SPELLMOD_THREAT
Definition SpellDefines.h:78
@ SPELLMOD_DURATION
Definition SpellDefines.h:77
@ SPELLMOD_CASTING_TIME
Definition SpellDefines.h:86
@ SPELLMOD_COST
Definition SpellDefines.h:90
T CalculatePct(T base, U pct)
Definition Util.h:61
void DropModCharge(SpellModifier *mod, Spell *spell)
Definition Player.cpp:10055
bool HasSpellMod(SpellModifier *mod, Spell *spell)
Definition Player.cpp:9747
bool IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell *spell=nullptr)
Definition Player.cpp:9755
Definition Player.h:181

References ASSERT, CalculatePct(), DropModCharge(), HasSpellMod(), IsAffectedBySpellmod(), m_spellMods, m_spellModTakingSpell, SPELLMOD_CASTING_TIME, SPELLMOD_COST, SPELLMOD_CRITICAL_CHANCE, SPELLMOD_DAMAGE, SPELLMOD_DOT, SPELLMOD_DURATION, SPELLMOD_FLAT, SPELLMOD_GLOBAL_COOLDOWN, SPELLMOD_PCT, SPELLMOD_THREAT, and sSpellMgr.

Referenced by AddSpellAndCategoryCooldowns(), Aura::CalcMaxDuration(), AuraEffect::CalculatePeriodic(), CastItemCombatSpell(), Spell::Delayed(), Spell::DelayedChannel(), and Spell::TriggerGlobalCooldown().

◆ ApplySpellPenetrationBonus()

void Player::ApplySpellPenetrationBonus ( int32  amount,
bool  apply 
)
237{
239 m_spellPenetrationItemMod += apply ? amount : -amount;
240}
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
Definition UpdateFields.h:366

References Object::ApplyModInt32Value(), m_spellPenetrationItemMod, and PLAYER_FIELD_MOD_TARGET_RESISTANCE.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplySpellPowerBonus()

void Player::ApplySpellPowerBonus ( int32  amount,
bool  apply 
)

◆ AreaExploredOrEventHappens()

void Player::AreaExploredOrEventHappens ( uint32  questId)
1792{
1793 if (questId)
1794 {
1795 uint16 log_slot = FindQuestSlot(questId);
1796 QuestStatusData* q_status = nullptr;
1797 if (log_slot < MAX_QUEST_LOG_SIZE)
1798 {
1799 q_status = &m_QuestStatus[questId];
1800
1801 // xinef: added failed check
1802 if (!q_status->Explored && q_status->Status != QUEST_STATUS_FAILED)
1803 {
1804 q_status->Explored = true;
1805 m_QuestStatusSave[questId] = true;
1806
1807 SendQuestComplete(questId);
1808 }
1809 }
1810 if (CanCompleteQuest(questId, q_status))
1811 CompleteQuest(questId);
1812 else
1814 }
1815}
@ ADDITIONAL_SAVING_QUEST_STATUS
Definition Player.h:1000
void SendQuestComplete(uint32 quest_id)
Definition PlayerQuest.cpp:2346
void AdditionalSavingAddMask(uint8 mask)
Definition Player.h:2590

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::Explored, FindQuestSlot(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_STATUS_FAILED, SendQuestComplete(), and QuestStatusData::Status.

Referenced by npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), Spell::EffectQuestComplete(), SmartAI::EndPath(), dragonmaw_race_npc::FinishRace(), go_ahune_ice_stone::GossipSelect(), GroupEventHappens(), WorldSession::HandleAreaTriggerOpcode(), boss_alar::JustDied(), go_table_theka::OnGossipHello(), npc_parqual_fintallas::OnGossipSelect(), npc_great_bear_spirit::OnGossipSelect(), npc_thrall_warchief::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_stone_watcher_of_norgannon::OnGossipSelect(), npc_vekjik::OnGossipSelect(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), npc_doctor::npc_doctorAI::PatientSaved(), npc_shenthul::npc_shenthulAI::ReceiveEmote(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), and npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI().

◆ AutoStoreLoot() [1/2]

void Player::AutoStoreLoot ( uint32  loot_id,
LootStore const &  store,
bool  broadcast = false 
)
inline
1330{ AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition Player.cpp:13455

References AutoStoreLoot(), NULL_BAG, and NULL_SLOT.

Referenced by AutoStoreLoot().

◆ AutoStoreLoot() [2/2]

void Player::AutoStoreLoot ( uint8  bag,
uint8  slot,
uint32  loot_id,
LootStore const &  store,
bool  broadcast = false 
)
13456{
13457 Loot loot;
13458 loot.FillLoot (loot_id, store, this, true);
13459
13460 uint32 max_slot = loot.GetMaxSlotInLootFor(this);
13461 for (uint32 i = 0; i < max_slot; ++i)
13462 {
13463 LootItem* lootItem = loot.LootItemInSlot(i, this);
13464
13465 ItemPosCountVec dest;
13466 InventoryResult msg = CanStoreNewItem(bag, slot, dest, lootItem->itemid, lootItem->count);
13467 if (msg != EQUIP_ERR_OK && slot != NULL_SLOT)
13468 msg = CanStoreNewItem(bag, NULL_SLOT, dest, lootItem->itemid, lootItem->count);
13469 if (msg != EQUIP_ERR_OK && bag != NULL_BAG)
13470 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, lootItem->itemid, lootItem->count);
13471 if (msg != EQUIP_ERR_OK)
13472 {
13473 SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
13474 continue;
13475 }
13476
13477 Item* pItem = StoreNewItem(dest, lootItem->itemid, true, lootItem->randomPropertyId);
13478 SendNewItem(pItem, lootItem->count, false, false, broadcast);
13479 }
13480}
Definition LootMgr.h:154
uint32 itemid
Definition LootMgr.h:155
int32 randomPropertyId
Definition LootMgr.h:158
uint8 count
Definition LootMgr.h:162
Definition LootMgr.h:313
uint32 GetMaxSlotInLootFor(Player *player) const
Definition LootMgr.cpp:916
LootItem * LootItemInSlot(uint32 lootslot, Player *player, QuestItem **qitem=nullptr, QuestItem **ffaitem=nullptr, QuestItem **conditem=nullptr)
Definition LootMgr.cpp:851
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition LootMgr.cpp:571

References CanStoreNewItem(), LootItem::count, EQUIP_ERR_OK, Loot::FillLoot(), Loot::GetMaxSlotInLootFor(), LootItem::itemid, Loot::LootItemInSlot(), NULL_BAG, NULL_SLOT, LootItem::randomPropertyId, SendEquipError(), SendNewItem(), and StoreNewItem().

Referenced by Group::CountTheRoll(), Spell::EffectCreateItem2(), Spell::EffectCreateRandomItem(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ AutoUnequipOffhandIfNeed()

void Player::AutoUnequipOffhandIfNeed ( bool  force = false)
12433{
12435 if (!offItem)
12436 {
12438 return;
12439 }
12440
12441 // unequip offhand weapon if player doesn't have dual wield anymore
12443 force = true;
12444
12445 // unequip offhand weapon if player main hand weapon is a polearm or staff or fishing pole
12447 if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
12448 if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
12449 mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
12450 mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
12451 force = true;
12452
12453 // need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
12454 if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
12455 {
12457 return;
12458 }
12459
12460 ItemPosCountVec off_dest;
12461 uint8 off_msg = CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false);
12462 if (off_msg == EQUIP_ERR_OK)
12463 {
12465 StoreItem(off_dest, offItem, true);
12466 }
12467 else
12468 {
12470 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
12471 offItem->DeleteFromInventoryDB(trans); // deletes item from character's inventory
12472 offItem->SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
12473
12474 std::string subject = GetSession()->GetAcoreString(LANG_NOT_EQUIPPED_ITEM);
12475 MailDraft(subject, "There were problems with equipping one or several items").AddItem(offItem).SendMailTo(trans, this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED);
12476
12477 CharacterDatabase.CommitTransaction(trans);
12478 }
12480}
@ ITEM_SUBCLASS_WEAPON_STAFF
Definition ItemTemplate.h:354
@ ITEM_SUBCLASS_WEAPON_FISHING_POLE
Definition ItemTemplate.h:364
@ ITEM_SUBCLASS_WEAPON_POLEARM
Definition ItemTemplate.h:350
@ INVTYPE_WEAPON
Definition ItemTemplate.h:269
@ INVTYPE_WEAPONOFFHAND
Definition ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
void SendMailTo(CharacterDatabaseTransaction trans, MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0, uint32 custom_expiration=0, bool deleteMailItemsFromDB=false, bool sendMail=true)
Definition Mail.cpp:185
MailDraft & AddItem(Item *item)
Definition Mail.cpp:93
bool CanTitanGrip() const
Definition Player.h:2205
bool IsTwoHandUsed() const
Definition Player.h:1379
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition PlayerStorage.cpp:2978
void RemoveItem(uint8 bag, uint8 slot, bool update, bool swap=false)
Definition PlayerStorage.cpp:2899
void UpdateTitansGrip()
Definition PlayerUpdates.cpp:1846
bool CanDualWield() const
Definition Unit.h:918
uint32 InventoryType
Definition ItemTemplate.h:632

References MailDraft::AddItem(), Unit::CanDualWield(), CanStoreItem(), CanTitanGrip(), CharacterDatabase, Item::DeleteFromInventoryDB(), EQUIP_ERR_OK, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, WorldSession::GetAcoreString(), GetItemByPos(), GetSession(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_WEAPON, INVTYPE_WEAPONOFFHAND, IsTwoHandUsed(), ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_POLEARM, ITEM_SUBCLASS_WEAPON_STAFF, LANG_NOT_EQUIPPED_ITEM, MAIL_CHECK_MASK_COPIED, MAIL_STATIONERY_GM, MoveItemFromInventory(), NULL_BAG, NULL_SLOT, RemoveItem(), Item::SaveToDB(), MailDraft::SendMailTo(), StoreItem(), and UpdateTitansGrip().

Referenced by _StoreOrEquipNewItem(), ActivateSpec(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoEquipItemOpcode(), resetTalents(), SplitItem(), StoreNewItemInBestSlots(), SwapItem(), and UpdateZone().

◆ BankItem() [1/2]

Item * Player::BankItem ( ItemPosCountVec const &  dest,
Item pItem,
bool  update 
)
inline

◆ BankItem() [2/2]

Item * Player::BankItem ( uint16  pos,
Item pItem,
bool  update 
)

◆ BindToInstance()

void Player::BindToInstance ( )
6523{
6524 InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(_pendingBindId);
6525 if (!mapSave) //it seems sometimes mapSave is nullptr, but I did not check why
6526 return;
6527
6529 data << uint32(0);
6530 GetSession()->SendPacket(&data);
6531 sInstanceSaveMgr->PlayerBindToInstance(this->GetGUID(), mapSave, true, this);
6532}
#define sInstanceSaveMgr
Definition InstanceSaveMgr.h:202
Definition InstanceSaveMgr.h:56
uint32 _pendingBindId
Definition Player.h:3009
@ SMSG_INSTANCE_SAVE_CREATED
Definition Opcodes.h:745

References _pendingBindId, Object::GetGUID(), GetSession(), WorldSession::SendPacket(), sInstanceSaveMgr, and SMSG_INSTANCE_SAVE_CREATED.

Referenced by WorldSession::HandleInstanceLockResponse(), and Update().

◆ BuildCreateUpdateBlockForPlayer()

void Player::BuildCreateUpdateBlockForPlayer ( UpdateData data,
Player target 
)
overridevirtual

Reimplemented from Object.

3843{
3844 if (target == this)
3845 {
3846 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
3847 {
3848 if (!m_items[i])
3849 continue;
3850
3851 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3852 }
3853
3855 {
3856 if (!m_items[i])
3857 continue;
3858
3859 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3860 }
3862 {
3863 if (!m_items[i])
3864 continue;
3865
3866 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3867 }
3868 }
3869
3871}
@ KEYRING_SLOT_START
Definition Player.h:737
@ BANK_SLOT_BAG_END
Definition Player.h:725
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:178

References BANK_SLOT_BAG_END, Object::BuildCreateUpdateBlockForPlayer(), CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_START, KEYRING_SLOT_START, and m_items.

Referenced by Map::SendInitSelf().

◆ BuildEnchantmentsInfoData()

void Player::BuildEnchantmentsInfoData ( WorldPacket data)
14402{
14403 uint32 slotUsedMask = 0;
14404 std::size_t slotUsedMaskPos = data->wpos();
14405 *data << uint32(slotUsedMask); // slotUsedMask < 0x80000
14406
14407 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14408 {
14410
14411 if (!item)
14412 continue;
14413
14414 slotUsedMask |= (1 << i);
14415
14416 *data << uint32(item->GetEntry()); // item entry
14417
14418 uint16 enchantmentMask = 0;
14419 std::size_t enchantmentMaskPos = data->wpos();
14420 *data << uint16(enchantmentMask); // enchantmentMask < 0x1000
14421
14422 for (uint32 j = 0; j < MAX_ENCHANTMENT_SLOT; ++j)
14423 {
14424 uint32 enchId = item->GetEnchantmentId(EnchantmentSlot(j));
14425
14426 if (!enchId)
14427 continue;
14428
14429 enchantmentMask |= (1 << j);
14430
14431 *data << uint16(enchId); // enchantmentId?
14432 }
14433
14434 data->put<uint16>(enchantmentMaskPos, enchantmentMask);
14435
14436 *data << int16(item->GetItemRandomPropertyId()); // item random property id
14437 *data << item->GetGuidValue(ITEM_FIELD_CREATOR).WriteAsPacked(); // item creator
14438 *data << uint32(item->GetItemSuffixFactor()); // item suffix factor
14439 }
14440
14441 data->put<uint32>(slotUsedMaskPos, slotUsedMask);
14442}
@ ITEM_FIELD_CREATOR
Definition UpdateFields.h:37
std::size_t wpos() const
Definition ByteBuffer.h:330
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
PackedGuid WriteAsPacked() const
Definition ObjectGuid.h:316
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:326

References EQUIPMENT_SLOT_END, Item::GetEnchantmentId(), Object::GetEntry(), Object::GetGuidValue(), GetItemByPos(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), INVENTORY_SLOT_BAG_0, ITEM_FIELD_CREATOR, MAX_ENCHANTMENT_SLOT, ByteBuffer::put(), ByteBuffer::wpos(), and ObjectGuid::WriteAsPacked().

Referenced by WorldSession::HandleInspectOpcode().

◆ BuildEnumData()

bool Player::BuildEnumData ( PreparedQueryResult  result,
WorldPacket data 
)
static
1100{
1101 // 0 1 2 3 4 5 6 7
1102 // "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.skin, characters.face, characters.hairStyle,
1103 // 8 9 10 11 12 13 14 15
1104 // characters.hairColor, characters.facialStyle, character.level, characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z,
1105 // 16 17 18 19 20 21 22 23
1106 // guild_member.guildid, characters.playerFlags, characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, character_banned.guid,
1107 // 24 25
1108 // characters.extra_flags, character_declinedname.genitive
1109
1110 Field* fields = result->Fetch();
1111
1112 ObjectGuid::LowType guidLow = fields[0].Get<uint32>();
1113 uint8 plrRace = fields[2].Get<uint8>();
1114 uint8 plrClass = fields[3].Get<uint8>();
1115 uint8 gender = fields[4].Get<uint8>();
1116
1117 ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
1118
1119 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
1120 if (!info)
1121 {
1122 LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Don't build enum.", guid.ToString());
1123 return false;
1124 }
1125 else if (!IsValidGender(gender))
1126 {
1127 LOG_ERROR("entities.player", "Player ({}) has incorrect gender ({}), don't build enum.", guid.ToString(), gender);
1128 return false;
1129 }
1130
1131 *data << guid;
1132 *data << fields[1].Get<std::string>(); // name
1133 *data << uint8(plrRace); // race
1134 *data << uint8(plrClass); // class
1135 *data << uint8(gender); // gender
1136
1137 uint8 skin = fields[5].Get<uint8>();
1138 uint8 face = fields[6].Get<uint8>();
1139 uint8 hairStyle = fields[7].Get<uint8>();
1140 uint8 hairColor = fields[8].Get<uint8>();
1141 uint8 facialStyle = fields[9].Get<uint8>();
1142
1143 uint32 charFlags = 0;
1144 uint32 playerFlags = fields[17].Get<uint32>();
1145 uint16 atLoginFlags = fields[18].Get<uint16>();
1146 uint32 zone = (atLoginFlags & AT_LOGIN_FIRST) != 0 ? 0 : fields[11].Get<uint16>(); // if first login do not show the zone
1147
1148 *data << uint8(skin);
1149 *data << uint8(face);
1150 *data << uint8(hairStyle);
1151 *data << uint8(hairColor);
1152 *data << uint8(facialStyle);
1153
1154 *data << uint8(fields[10].Get<uint8>()); // level
1155 *data << uint32(zone); // zone
1156 *data << uint32(fields[12].Get<uint16>()); // map
1157
1158 *data << fields[13].Get<float>(); // x
1159 *data << fields[14].Get<float>(); // y
1160 *data << fields[15].Get<float>(); // z
1161
1162 *data << uint32(fields[16].Get<uint32>()); // guild id
1163
1164 if (playerFlags & PLAYER_FLAGS_RESTING)
1165 playerFlags |= CHARACTER_FLAG_RESTING;
1166 if (atLoginFlags & AT_LOGIN_RESURRECT)
1167 playerFlags &= ~PLAYER_FLAGS_GHOST;
1168 if (playerFlags & PLAYER_FLAGS_HIDE_HELM)
1169 charFlags |= CHARACTER_FLAG_HIDE_HELM;
1170 if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK)
1171 charFlags |= CHARACTER_FLAG_HIDE_CLOAK;
1172 if (playerFlags & PLAYER_FLAGS_GHOST)
1173 charFlags |= CHARACTER_FLAG_GHOST;
1174 if (atLoginFlags & AT_LOGIN_RENAME)
1175 charFlags |= CHARACTER_FLAG_RENAME;
1176 if (fields[23].Get<uint32>())
1178 if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
1179 {
1180 if (!fields[25].Get<std::string>().empty())
1181 charFlags |= CHARACTER_FLAG_DECLINED;
1182 }
1183 else
1184 charFlags |= CHARACTER_FLAG_DECLINED;
1185
1186 *data << uint32(charFlags); // character flags
1187
1188 // character customize flags
1189 if (atLoginFlags & AT_LOGIN_CUSTOMIZE)
1191 else if (atLoginFlags & AT_LOGIN_CHANGE_FACTION)
1193 else if (atLoginFlags & AT_LOGIN_CHANGE_RACE)
1195 else
1197
1198 // First login
1199 *data << uint8(atLoginFlags & AT_LOGIN_FIRST ? 1 : 0);
1200
1201 // Pets info
1202 uint32 petDisplayId = 0;
1203 uint32 petLevel = 0;
1204 uint32 petFamily = 0;
1205
1206 // show pet at selection character in character list only for non-ghost character
1207 if (result && !(playerFlags & PLAYER_FLAGS_GHOST) && (plrClass == CLASS_WARLOCK || plrClass == CLASS_HUNTER || (plrClass == CLASS_DEATH_KNIGHT && (fields[21].Get<uint32>()&PLAYER_EXTRA_SHOW_DK_PET))))
1208 {
1209 uint32 entry = fields[19].Get<uint32>();
1210 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(entry);
1211 if (creatureInfo)
1212 {
1213 petDisplayId = fields[20].Get<uint32>();
1214 petLevel = fields[21].Get<uint16>();
1215 petFamily = creatureInfo->family;
1216 }
1217 }
1218
1219 *data << uint32(petDisplayId);
1220 *data << uint32(petLevel);
1221 *data << uint32(petFamily);
1222
1223 std::vector<std::string_view> equipment = Acore::Tokenize(fields[22].Get<std::string_view>(), ' ', false);
1224 for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
1225 {
1226 uint32 const visualBase = slot * 2;
1227 Optional<uint32> itemId;
1228
1229 if (visualBase < equipment.size())
1230 {
1231 itemId = Acore::StringTo<uint32>(equipment[visualBase]);
1232 }
1233
1234 ItemTemplate const* proto = nullptr;
1235 if (itemId)
1236 {
1237 proto = sObjectMgr->GetItemTemplate(*itemId);
1238 }
1239
1240 if (!proto)
1241 {
1242 if (!itemId || *itemId)
1243 {
1244 LOG_WARN("entities.player.loading", "Player {} has invalid equipment '{}' in `equipmentcache` at index {}. Skipped.",
1245 guid.ToString(), (visualBase < equipment.size()) ? equipment[visualBase] : "<none>", visualBase);
1246 }
1247
1248 *data << uint32(0);
1249 *data << uint8(0);
1250 *data << uint32(0);
1251
1252 continue;
1253 }
1254
1255 SpellItemEnchantmentEntry const* enchant = nullptr;
1256
1257 Optional<uint32> enchants = {};
1258 if ((visualBase + 1) < equipment.size())
1259 {
1260 enchants = Acore::StringTo<uint32>(equipment[visualBase + 1]);
1261 }
1262
1263 if (!enchants)
1264 {
1265 LOG_WARN("entities.player.loading", "Player {} has invalid enchantment info '{}' in `equipmentcache` at index {}. Skipped.",
1266 guid.ToString(), ((visualBase + 1) < equipment.size()) ? equipment[visualBase + 1] : "<none>", visualBase + 1);
1267
1268 enchants = 0;
1269 }
1270
1271 for (uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot)
1272 {
1273 // values stored in 2 uint16
1274 uint32 enchantId = 0x0000FFFF & ((*enchants) >> enchantSlot * 16);
1275 if (!enchantId)
1276 {
1277 continue;
1278 }
1279
1280 enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
1281 if (enchant)
1282 {
1283 break;
1284 }
1285 }
1286
1287 *data << uint32(proto->DisplayInfoID);
1288 *data << uint8(proto->InventoryType);
1289 *data << uint32(enchant ? enchant->aura_id : 0);
1290 }
1291
1292 return true;
1293}
@ CHAR_CUSTOMIZE_FLAG_RACE
Definition Player.cpp:142
@ CHAR_CUSTOMIZE_FLAG_NONE
Definition Player.cpp:139
@ CHAR_CUSTOMIZE_FLAG_FACTION
Definition Player.cpp:141
@ CHAR_CUSTOMIZE_FLAG_CUSTOMIZE
Definition Player.cpp:140
@ CHARACTER_FLAG_RESTING
Definition Player.cpp:104
@ CHARACTER_FLAG_GHOST
Definition Player.cpp:116
@ CHARACTER_FLAG_DECLINED
Definition Player.cpp:128
@ CHARACTER_FLAG_HIDE_HELM
Definition Player.cpp:113
@ CHARACTER_FLAG_HIDE_CLOAK
Definition Player.cpp:114
@ CHARACTER_FLAG_LOCKED_BY_BILLING
Definition Player.cpp:127
@ CHARACTER_FLAG_RENAME
Definition Player.cpp:117
@ PLAYER_EXTRA_SHOW_DK_PET
Definition Player.h:599
@ PLAYER_FLAGS_HIDE_CLOAK
Definition Player.h:491
@ PLAYER_FLAGS_GHOST
Definition Player.h:484
@ PLAYER_FLAGS_HIDE_HELM
Definition Player.h:490
@ AT_LOGIN_FIRST
Definition Player.h:612
@ AT_LOGIN_RESURRECT
Definition Player.h:618
@ AT_LOGIN_CUSTOMIZE
Definition Player.h:610
@ AT_LOGIN_RENAME
Definition Player.h:607
@ AT_LOGIN_CHANGE_RACE
Definition Player.h:614
@ AT_LOGIN_CHANGE_FACTION
Definition Player.h:613
@ CLASS_HUNTER
Definition SharedDefines.h:143
@ CLASS_WARLOCK
Definition SharedDefines.h:149
@ CONFIG_DECLINED_NAMES_USED
Definition WorldConfig.h:67
static bool IsValidGender(uint8 Gender)
Definition Player.h:1586
Definition CreatureData.h:186
uint32 DisplayInfoID
Definition ItemTemplate.h:625
uint32 aura_id
Definition DBCStructure.h:1851

References AT_LOGIN_CHANGE_FACTION, AT_LOGIN_CHANGE_RACE, AT_LOGIN_CUSTOMIZE, AT_LOGIN_FIRST, AT_LOGIN_RENAME, AT_LOGIN_RESURRECT, SpellItemEnchantmentEntry::aura_id, CHAR_CUSTOMIZE_FLAG_CUSTOMIZE, CHAR_CUSTOMIZE_FLAG_FACTION, CHAR_CUSTOMIZE_FLAG_NONE, CHAR_CUSTOMIZE_FLAG_RACE, CHARACTER_FLAG_DECLINED, CHARACTER_FLAG_GHOST, CHARACTER_FLAG_HIDE_CLOAK, CHARACTER_FLAG_HIDE_HELM, CHARACTER_FLAG_LOCKED_BY_BILLING, CHARACTER_FLAG_RENAME, CHARACTER_FLAG_RESTING, CLASS_DEATH_KNIGHT, CLASS_HUNTER, CLASS_WARLOCK, CONFIG_DECLINED_NAMES_USED, ItemTemplate::DisplayInfoID, Field::Get(), INVENTORY_SLOT_BAG_END, ItemTemplate::InventoryType, IsValidGender(), LOG_ERROR, LOG_WARN, PERM_ENCHANTMENT_SLOT, PLAYER_EXTRA_SHOW_DK_PET, PLAYER_FLAGS_GHOST, PLAYER_FLAGS_HIDE_CLOAK, PLAYER_FLAGS_HIDE_HELM, PLAYER_FLAGS_RESTING, sObjectMgr, sSpellItemEnchantmentStore, sWorld, TEMP_ENCHANTMENT_SLOT, and Acore::Tokenize().

Referenced by WorldSession::HandleCharEnum().

◆ BuildPetTalentsInfoData()

void Player::BuildPetTalentsInfoData ( WorldPacket data)
14319{
14320 uint32 unspentTalentPoints = 0;
14321 std::size_t pointsPos = data->wpos();
14322 *data << uint32(unspentTalentPoints); // [PH], unspentTalentPoints
14323
14324 uint8 talentIdCount = 0;
14325 std::size_t countPos = data->wpos();
14326 *data << uint8(talentIdCount); // [PH], talentIdCount
14327
14328 Pet* pet = GetPet();
14329 if (!pet)
14330 return;
14331
14332 unspentTalentPoints = pet->GetFreeTalentPoints();
14333
14334 data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
14335
14336 CreatureTemplate const* ci = pet->GetCreatureTemplate();
14337 if (!ci)
14338 return;
14339
14340 CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
14341 if (!pet_family || pet_family->petTalentType < 0)
14342 return;
14343
14344 for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
14345 {
14346 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
14347 if (!talentTabInfo)
14348 continue;
14349
14350 if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
14351 continue;
14352
14353 for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
14354 {
14355 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
14356 if (!talentInfo)
14357 continue;
14358
14359 // skip another tab talents
14360 if (talentInfo->TalentTab != talentTabId)
14361 continue;
14362
14363 // find max talent rank (0~4)
14364 int8 curtalent_maxrank = -1;
14365 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
14366 {
14367 if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
14368 {
14369 curtalent_maxrank = rank;
14370 break;
14371 }
14372 }
14373
14374 // not learned talent
14375 if (curtalent_maxrank < 0)
14376 continue;
14377
14378 *data << uint32(talentInfo->TalentID); // Talent.dbc
14379 *data << uint8(curtalent_maxrank); // talentMaxRank (0-4)
14380
14381 ++talentIdCount;
14382 }
14383
14384 data->put<uint8>(countPos, talentIdCount); // put real count
14385
14386 break;
14387 }
14388}
DBCStorage< TalentTabEntry > sTalentTabStore(TalentTabEntryfmt)
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
#define MAX_TALENT_RANK
Definition DBCStructure.h:1919
std::int8_t int8
Definition Define.h:105
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:209
uint8 GetFreeTalentPoints()
Definition Pet.h:131
bool HasSpell(uint32 spell) const override
Definition Pet.cpp:2343
Definition DBCStructure.h:754
int32 petTalentType
Definition DBCStructure.h:762
uint32 TalentTab
Definition DBCStructure.h:1926
Definition DBCStructure.h:1941
uint32 petTalentMask
Definition DBCStructure.h:1948

References Creature::GetCreatureTemplate(), Pet::GetFreeTalentPoints(), GetPet(), Pet::HasSpell(), MAX_TALENT_RANK, TalentTabEntry::petTalentMask, CreatureFamilyEntry::petTalentType, ByteBuffer::put(), TalentEntry::RankID, sCreatureFamilyStore, sTalentStore, sTalentTabStore, TalentEntry::TalentID, TalentEntry::TalentTab, and ByteBuffer::wpos().

Referenced by SendTalentsInfoData().

◆ BuildPlayerRepop()

void Player::BuildPlayerRepop ( )
4456{
4458 data << GetPackGUID();
4459 GetSession()->SendPacket(&data);
4460 if (getRace(true) == RACE_NIGHTELF)
4461 {
4462 CastSpell(this, 20584, true);
4463 }
4464 CastSpell(this, 8326, true);
4465
4466 // there must be SMSG.FORCE_RUN_SPEED_CHANGE, SMSG.FORCE_SWIM_SPEED_CHANGE, SMSG.MOVE_WATER_WALK
4467 // there must be SMSG.STOP_MIRROR_TIMER
4468
4469 // the player cannot have a corpse already on current map, only bones which are not returned by GetCorpse
4470 WorldLocation corpseLocation = GetCorpseLocation();
4471 if (GetCorpse() && corpseLocation.GetMapId() == GetMapId())
4472 {
4473 LOG_ERROR("entities.player", "BuildPlayerRepop: player {} ({}) already has a corpse", GetName(), GetGUID().ToString());
4474 return;
4475 }
4476
4477 // create a corpse and place it at the player's location
4478 Corpse* corpse = CreateCorpse();
4479 if (!corpse)
4480 {
4481 LOG_ERROR("entities.player", "Error creating corpse for Player {} [{}]", GetName(), GetGUID().ToString());
4482 return;
4483 }
4484 GetMap()->AddToMap(corpse);
4485 SetHealth(1); // convert player body to ghost
4487 SetWaterWalking(true);
4488 if (!GetSession()->isLogingOut())
4489 {
4491 }
4492 RemoveUnitFlag(UNIT_FLAG_SKINNABLE); // BG - remove insignia related
4493 int32 corpseReclaimDelay = CalculateCorpseReclaimDelay();
4494 if (corpseReclaimDelay >= 0)
4495 {
4496 SendCorpseReclaimDelay(corpseReclaimDelay);
4497 }
4498 corpse->ResetGhostTime(); // to prevent cheating
4499 StopMirrorTimers(); // disable timers on bars
4501 sScriptMgr->OnPlayerReleasedGhost(this);
4502}
@ MOVE_UNROOT
Definition Player.h:463
@ MOVE_WATER_WALK
Definition Player.h:464
@ RACE_NIGHTELF
Definition SharedDefines.h:74
@ UNIT_BYTE1_FLAG_ALWAYS_STAND
Definition UnitDefines.h:59
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition UnitDefines.h:26
@ UNIT_FLAG_SKINNABLE
Definition UnitDefines.h:276
@ UNIT_FIELD_BYTES_1
Definition UpdateFields.h:131
Definition Corpse.h:49
void ResetGhostTime()
Definition Corpse.cpp:195
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:294
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:739
PackedGuid const & GetPackGUID() const
Definition Object.h:115
void SendCorpseReclaimDelay(uint32 delay)
Definition Player.cpp:12943
void StopMirrorTimers()
Definition Player.h:2072
WorldLocation GetCorpseLocation() const
Definition Player.h:2056
Corpse * GetCorpse() const
Definition Player.cpp:4740
bool SetWaterWalking(bool apply, bool packetOnly=false) override
Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for...
Definition Player.cpp:15930
int32 CalculateCorpseReclaimDelay(bool load=false)
Definition Player.cpp:12902
Corpse * CreateCorpse()
Definition Player.cpp:4625
void SetMovement(PlayerMovementType pType)
Definition Player.cpp:4425
void SetHealth(uint32 val)
Definition Unit.cpp:15570
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:704
Map * GetMap() const
Definition Object.h:610
@ SMSG_PRE_RESURRECT
Definition Opcodes.h:1202

References Map::AddToMap(), CalculateCorpseReclaimDelay(), Unit::CastSpell(), CreateCorpse(), GetCorpse(), GetCorpseLocation(), Object::GetGUID(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetName(), Object::GetPackGUID(), Unit::getRace(), GetSession(), LOG_ERROR, MOVE_UNROOT, MOVE_WATER_WALK, RACE_NIGHTELF, Unit::RemoveUnitFlag(), Corpse::ResetGhostTime(), SendCorpseReclaimDelay(), WorldSession::SendPacket(), Object::SetByteValue(), Unit::SetHealth(), SetMovement(), SetWaterWalking(), SMSG_PRE_RESURRECT, sScriptMgr, StopMirrorTimers(), Position::ToString(), UNIT_BYTE1_FLAG_ALWAYS_STAND, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, and UNIT_FLAG_SKINNABLE.

Referenced by Spell::EffectStuck(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleRepopRequestOpcode(), WorldSession::LogoutPlayer(), RemovedInsignia(), and Update().

◆ BuildPlayerTalentsInfoData()

void Player::BuildPlayerTalentsInfoData ( WorldPacket data)
14285{
14286 *data << uint32(GetFreeTalentPoints()); // unspentTalentPoints
14287 *data << uint8(m_specsCount); // talent group count (0, 1 or 2)
14288 *data << uint8(m_activeSpec); // talent group index (0 or 1)
14289
14292
14293 for (uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx)
14294 {
14295 uint8 talentIdCount = 0;
14296 std::size_t pos = data->wpos();
14297 *data << uint8(talentIdCount); // [PH], talentIdCount
14298
14299 const PlayerTalentMap& talentMap = GetTalentMap();
14300 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
14301 if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first))
14302 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(specIdx)) // pussywizard
14303 {
14304 *data << uint32(talentPos->talent_id); // Talent.dbc
14305 *data << uint8(talentPos->rank); // talentMaxRank (0-4)
14306 ++talentIdCount;
14307 }
14308
14309 data->put<uint8>(pos, talentIdCount); // put real count
14310
14311 *data << uint8(MAX_GLYPH_SLOT_INDEX); // glyphs count
14312
14313 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
14314 *data << uint16(m_Glyphs[specIdx][i]); // GlyphProperties.dbc
14315 }
14316}
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition Player.h:193
uint32 GetFreeTalentPoints() const
Definition Player.h:1727
const PlayerTalentMap & GetTalentMap() const
Definition Player.h:2626

References GetFreeTalentPoints(), GetTalentMap(), GetTalentSpellPos(), m_activeSpec, m_Glyphs, m_specsCount, MAX_GLYPH_SLOT_INDEX, MAX_TALENT_SPECS, PLAYERSPELL_REMOVED, ByteBuffer::put(), and ByteBuffer::wpos().

Referenced by WorldSession::HandleInspectOpcode(), and SendTalentsInfoData().

◆ BuyItemFromVendorSlot()

bool Player::BuyItemFromVendorSlot ( ObjectGuid  vendorguid,
uint32  vendorslot,
uint32  item,
uint8  count,
uint8  bag,
uint8  slot 
)
10690{
10691 sScriptMgr->OnPlayerBeforeBuyItemFromVendor(this, vendorguid, vendorslot, item, count, bag, slot);
10692
10693 // this check can be used from the hook to implement a custom vendor process
10694 if (item == 0)
10695 return true;
10696
10697 // cheating attempt
10698 if (count < 1) count = 1;
10699
10700 // cheating attempt
10701 if (slot > MAX_BAG_SIZE && slot != NULL_SLOT)
10702 return false;
10703
10704 if (!IsAlive())
10705 return false;
10706
10707 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
10708 if (!pProto)
10709 {
10710 SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
10711 return false;
10712 }
10713
10714 if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster())
10715 {
10716 SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
10717 return false;
10718 }
10719
10721 {
10722 return false;
10723 }
10724
10725 Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
10726 if (!creature)
10727 {
10728 LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit ({}) not found or you can't interact with him.", vendorguid.ToString());
10729 SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item, 0);
10730 return false;
10731 }
10732
10733 ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), item);
10734 if (!sConditionMgr->IsObjectMeetToConditions(this, creature, conditions))
10735 {
10736 //LOG_DEBUG("condition", "BuyItemFromVendor: conditions not met for creature entry {} item {}", creature->GetEntry(), item);
10737 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10738 return false;
10739 }
10740
10741 VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems();
10742 if (!vItems || vItems->Empty())
10743 {
10744 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10745 return false;
10746 }
10747
10748 if (vendorslot >= vItems->GetItemCount())
10749 {
10750 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10751 return false;
10752 }
10753
10754 VendorItem const* crItem = vItems->GetItem(vendorslot);
10755 // store diff item (cheating)
10756 if (!crItem || crItem->item != item)
10757 {
10758 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10759 return false;
10760 }
10761
10762 // check current item amount if it limited
10763 if (crItem->maxcount != 0)
10764 {
10765 if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
10766 {
10767 SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
10768 return false;
10769 }
10770 }
10771
10773 {
10774 SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
10775 return false;
10776 }
10777
10778 if (crItem->ExtendedCost)
10779 {
10780 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
10781 if (!iece)
10782 {
10783 LOG_ERROR("entities.player", "Item {} have wrong ExtendedCost field value {}", pProto->ItemId, crItem->ExtendedCost);
10784 return false;
10785 }
10786
10787 // honor points price
10788 if (GetHonorPoints() < (iece->reqhonorpoints * count))
10789 {
10791 return false;
10792 }
10793
10794 // arena points price
10795 if (GetArenaPoints() < (iece->reqarenapoints * count))
10796 {
10798 return false;
10799 }
10800
10801 // item base price
10802 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
10803 {
10804 if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
10805 {
10807 return false;
10808 }
10809 }
10810
10811 // check for personal arena rating requirement
10813 {
10814 // probably not the proper equip err
10815 SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, nullptr, nullptr);
10816 return false;
10817 }
10818 }
10819
10820 uint32 price = 0;
10821 if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
10822 {
10823 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
10824 if ((uint32)count > maxCount)
10825 {
10826 LOG_ERROR("entities.player", "Player {} tried to buy {} item id {}, causing overflow", GetName(), (uint32)count, pProto->ItemId);
10827 count = (uint8)maxCount;
10828 }
10829 price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
10830
10831 // reputation discount
10832 price = uint32(std::floor(price * GetReputationPriceDiscount(creature)));
10833
10834 if (!HasEnoughMoney(price))
10835 {
10836 SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
10837 return false;
10838 }
10839 }
10840
10841 if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot))
10842 {
10843 if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, true))
10844 return false;
10845 }
10846 else if (IsEquipmentPos(bag, slot))
10847 {
10848 if (pProto->BuyCount * count != 1)
10849 {
10851 return false;
10852 }
10853 if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false))
10854 return false;
10855 }
10856 else
10857 {
10859 return false;
10860 }
10861
10862 return crItem->maxcount != 0;
10863}
#define MAX_BAG_SIZE
Definition Bag.h:22
#define sConditionMgr
Definition ConditionMgr.h:290
std::list< Condition * > ConditionList
Definition ConditionMgr.h:237
@ ITEM_FLAG2_FACTION_HORDE
Definition ItemTemplate.h:183
@ ITEM_FLAG2_FACTION_ALLIANCE
Definition ItemTemplate.h:184
@ EQUIP_ERR_CANT_EQUIP_RANK
Definition Item.h:110
@ EQUIP_ERR_ITEM_CANT_BE_EQUIPPED
Definition Item.h:67
@ EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS
Definition Item.h:116
@ EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT
Definition Item.h:50
@ EQUIP_ERR_VENDOR_MISSING_TURNINS
Definition Item.h:115
@ EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS
Definition Item.h:117
@ BUY_ERR_CANT_FIND_ITEM
Definition Item.h:141
@ BUY_ERR_DISTANCE_TOO_FAR
Definition Item.h:145
@ BUY_ERR_NOT_ENOUGHT_MONEY
Definition Item.h:143
@ BUY_ERR_REPUTATION_REQUIRE
Definition Item.h:149
@ BUY_ERR_ITEM_ALREADY_SOLD
Definition Item.h:142
#define MAX_MONEY_AMOUNT
Definition Player.h:937
@ TEAM_ALLIANCE
Definition SharedDefines.h:760
@ TEAM_HORDE
Definition SharedDefines.h:761
@ UNIT_NPC_FLAG_VENDOR
Definition UnitDefines.h:322
Definition Creature.h:43
VendorItemData const * GetVendorItems() const
Definition Creature.cpp:3070
uint32 GetVendorItemCurrentCount(VendorItem const *vItem)
Definition Creature.cpp:3075
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const *crItem, bool bStore)
Definition Player.cpp:10623
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition PlayerStorage.cpp:655
bool HasEnoughMoney(uint32 amount) const
Definition Player.h:1623
Creature * GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
Definition Player.cpp:2089
bool IsGameMaster() const
Definition Player.h:1177
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:5895
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition PlayerStorage.cpp:4064
uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const
If trans is specified, arena point save query will be added to trans.
Definition Player.cpp:10865
uint32 GetCurrentVendor() const
Definition WorldSession.h:385
uint32 reqarenaslot
Definition DBCStructure.h:1190
uint32 reqpersonalarenarating
Definition DBCStructure.h:1193
uint32 BuyCount
Definition ItemTemplate.h:629
uint32 AllowableClass
Definition ItemTemplate.h:633
int32 BuyPrice
Definition ItemTemplate.h:630
bool HasFlag2(ItemFlags2 flag) const
Definition ItemTemplate.h:827
uint32 RequiredReputationRank
Definition ItemTemplate.h:643
uint32 RequiredReputationFaction
Definition ItemTemplate.h:642
uint32 ItemId
Definition ItemTemplate.h:620
Definition CreatureData.h:469
VendorItem * GetItem(uint32 slot) const
Definition CreatureData.h:472
bool Empty() const
Definition CreatureData.h:479
uint8 GetItemCount() const
Definition CreatureData.h:480
Definition CreatureData.h:454
uint32 ExtendedCost
Definition CreatureData.h:461
bool IsGoldRequired(ItemTemplate const *pProto) const
Definition CreatureData.h:464
uint32 item
Definition CreatureData.h:458
uint32 maxcount
Definition CreatureData.h:459

References _StoreOrEquipNewItem(), ItemTemplate::AllowableClass, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, BUY_ERR_CANT_FIND_ITEM, BUY_ERR_DISTANCE_TOO_FAR, BUY_ERR_ITEM_ALREADY_SOLD, BUY_ERR_NOT_ENOUGHT_MONEY, BUY_ERR_REPUTATION_REQUIRE, ItemTemplate::BuyCount, ItemTemplate::BuyPrice, VendorItemData::Empty(), EQUIP_ERR_CANT_EQUIP_RANK, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, EQUIP_ERR_VENDOR_MISSING_TURNINS, VendorItem::ExtendedCost, GetArenaPoints(), Unit::getClassMask(), WorldSession::GetCurrentVendor(), Object::GetEntry(), GetHonorPoints(), VendorItemData::GetItem(), VendorItemData::GetItemCount(), GetMaxPersonalArenaRatingRequirement(), WorldObject::GetName(), GetNPCIfCanInteractWith(), GetReputationPriceDiscount(), GetReputationRank(), GetSession(), GetTeamId(), Creature::GetVendorItemCurrentCount(), Creature::GetVendorItems(), HasEnoughMoney(), ItemTemplate::HasFlag2(), HasItemCount(), Unit::IsAlive(), IsEquipmentPos(), IsGameMaster(), VendorItem::IsGoldRequired(), IsInventoryPos(), VendorItem::item, ITEM_FLAG2_FACTION_ALLIANCE, ITEM_FLAG2_FACTION_HORDE, ItemTemplate::ItemId, LOG_DEBUG, LOG_ERROR, MAX_BAG_SIZE, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, MAX_MONEY_AMOUNT, VendorItem::maxcount, NULL_BAG, NULL_SLOT, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqarenaslot, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, ItemExtendedCostEntry::reqpersonalarenarating, ItemTemplate::RequiredReputationFaction, ItemTemplate::RequiredReputationRank, sConditionMgr, SendBuyError(), SendEquipError(), sItemExtendedCostStore, sObjectMgr, sScriptMgr, TEAM_ALLIANCE, TEAM_HORDE, ObjectGuid::ToString(), and UNIT_NPC_FLAG_VENDOR.

Referenced by WorldSession::HandleBuyItemInSlotOpcode(), and WorldSession::HandleBuyItemOpcode().

◆ CalcRage()

void Player::CalcRage ( uint32  damage,
bool  attacker 
)

◆ CalculateCorpseReclaimDelay()

int32 Player::CalculateCorpseReclaimDelay ( bool  load = false)
12903{
12904 Corpse* corpse = GetCorpse();
12905
12906 if (load && !corpse)
12907 return -1;
12908
12909 bool pvp = corpse ? corpse->GetType() == CORPSE_RESURRECTABLE_PVP : m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
12910
12911 uint32 delay;
12912
12913 if (load)
12914 {
12915 if (corpse->GetGhostTime() > m_deathExpireTime)
12916 return -1;
12917
12918 uint64 count = 0;
12919
12920 if ((pvp && sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
12921 (!pvp && sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
12922 {
12923 count = (m_deathExpireTime - corpse->GetGhostTime()) / DEATH_EXPIRE_STEP;
12924
12925 if (count >= MAX_DEATH_COUNT)
12926 count = MAX_DEATH_COUNT - 1;
12927 }
12928
12929 time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
12930 time_t now = GameTime::GetGameTime().count();
12931
12932 if (now >= expected_time)
12933 return -1;
12934
12935 delay = expected_time - now;
12936 }
12937 else
12938 delay = GetCorpseReclaimDelay(pvp);
12939
12940 return delay * IN_MILLISECONDS;
12941}
@ CORPSE_RESURRECTABLE_PVP
Definition Corpse.h:30
static uint32 copseReclaimDelay[MAX_DEATH_COUNT]
Definition Player.cpp:145
@ PLAYER_EXTRA_PVP_DEATH
Definition Player.h:598
#define DEATH_EXPIRE_STEP
Definition Player.h:75
#define MAX_DEATH_COUNT
Definition Player.h:76
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP
Definition WorldConfig.h:62
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE
Definition WorldConfig.h:63
time_t const & GetGhostTime() const
Definition Corpse.h:70
CorpseType GetType() const
Definition Corpse.h:72
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition Player.cpp:12885

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, copseReclaimDelay, CORPSE_RESURRECTABLE_PVP, DEATH_EXPIRE_STEP, GetCorpse(), GetCorpseReclaimDelay(), GameTime::GetGameTime(), Corpse::GetGhostTime(), Corpse::GetType(), IN_MILLISECONDS, m_deathExpireTime, m_ExtraFlags, MAX_DEATH_COUNT, PLAYER_EXTRA_PVP_DEATH, and sWorld.

Referenced by BuildPlayerRepop(), and KillPlayer().

◆ CalculateMinMaxDamage()

void Player::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex 
)
overridevirtual

Implements Unit.

545{
546 // Only proto damage, not affected by any mods
547 if (damageIndex != 0)
548 {
549 minDamage = 0.0f;
550 maxDamage = 0.0f;
551
552 if (!IsInFeralForm() && CanUseAttackType(attType))
553 {
554 minDamage = GetWeaponDamageRange(attType, MINDAMAGE, damageIndex);
555 maxDamage = GetWeaponDamageRange(attType, MAXDAMAGE, damageIndex);
556 }
557
558 return;
559 }
560
561 UnitMods unitMod;
562
563 switch (attType)
564 {
565 case BASE_ATTACK:
566 default:
567 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
568 break;
569 case OFF_ATTACK:
570 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
571 break;
572 case RANGED_ATTACK:
573 unitMod = UNIT_MOD_DAMAGE_RANGED;
574 break;
575 }
576
577 float attackSpeedMod = GetAPMultiplier(attType, normalized);
578
579 float baseValue = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * attackSpeedMod;
580 float basePct = GetModifierValue(unitMod, BASE_PCT);
581 float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
582 float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
583
584 float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
585 float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
586
587 if (IsAttackSpeedOverridenShapeShift()) // forms with no override on attack speed use normal weapon damage
588 {
589 uint8 lvl = GetLevel();
590 if (lvl > 60)
591 lvl = 60;
592
593 weaponMinDamage = lvl * 0.85f * attackSpeedMod;
594 weaponMaxDamage = lvl * 1.25f * attackSpeedMod;
595 }
596 else if (!CanUseAttackType(attType)) // check if player not in form but still can't use (disarm case)
597 {
598 // cannot use ranged/off attack, set values to 0
599 if (attType != BASE_ATTACK)
600 {
601 minDamage = 0.0f;
602 maxDamage = 0.0f;
603 return;
604 }
605 weaponMinDamage = BASE_MINDAMAGE;
606 weaponMaxDamage = BASE_MAXDAMAGE;
607 }
608 else if (attType == RANGED_ATTACK) // add ammo DPS to ranged damage
609 {
610 weaponMinDamage += GetAmmoDPS() * attackSpeedMod;
611 weaponMaxDamage += GetAmmoDPS() * attackSpeedMod;
612 }
613
614 minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct;
615 maxDamage = ((weaponMaxDamage + baseValue) * basePct + totalValue) * totalPct;
616
617 // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
618 if (minDamage < 0.0f || minDamage > 1000000000.0f)
619 minDamage = 0.0f;
620 if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
621 maxDamage = 0.0f;
622 if (minDamage > maxDamage)
623 minDamage = maxDamage;
624}
@ BASE_PCT
Definition Unit.h:128
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:15520
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition Unit.cpp:15380
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition Unit.cpp:17292
bool IsAttackSpeedOverridenShapeShift() const
Definition Unit.cpp:19335

References BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, Unit::CanUseAttackType(), GetAmmoDPS(), Unit::GetAPMultiplier(), Unit::GetLevel(), Unit::GetModifierValue(), Unit::GetTotalAttackPowerValue(), Unit::GetWeaponDamageRange(), Unit::IsAttackSpeedOverridenShapeShift(), Unit::IsInFeralForm(), MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

◆ CalculateQuestRewardXP()

uint32 Player::CalculateQuestRewardXP ( Quest const *  quest)
1403{
1404 // apply world quest rate
1405 uint32 xp = uint32(quest->XPValue(GetLevel()) * GetQuestRate(quest->IsDFQuest()));
1406
1407 // handle SPELL_AURA_MOD_XP_QUEST_PCT auras
1409 for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
1410 AddPct(xp, (*i)->GetAmount());
1411
1412 return xp;
1413}
@ SPELL_AURA_MOD_XP_QUEST_PCT
Definition SpellAuraDefines.h:354
T AddPct(T &base, U pct)
Definition Util.h:67
float GetQuestRate(bool isDFQuest=false)
Definition Player.cpp:16214

References AddPct(), Unit::GetAuraEffectsByType(), Unit::GetLevel(), GetQuestRate(), Quest::IsDFQuest(), SPELL_AURA_MOD_XP_QUEST_PCT, and Quest::XPValue().

Referenced by RewardQuest(), PlayerMenu::SendQuestGiverOfferReward(), and PlayerMenu::SendQuestGiverQuestDetails().

◆ CalculateReputationGain()

float Player::CalculateReputationGain ( ReputationSource  source,
uint32  creatureOrQuestLevel,
float  rep,
int32  faction,
bool  noQuestBonus = false 
)
5903{
5904 float percent = 100.0f;
5905
5906 float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
5907
5908 // faction specific auras only seem to apply to kills
5909 if (source == REPUTATION_SOURCE_KILL)
5911
5912 percent += rep > 0.f ? repMod : -repMod;
5913
5914 float rate;
5915 switch (source)
5916 {
5918 rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
5919 break;
5925 rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
5926 break;
5928 default:
5929 rate = 1.0f;
5930 break;
5931 }
5932
5933 if (rate != 1.0f && creatureOrQuestLevel <= Acore::XP::GetGrayLevel(GetLevel()))
5934 percent *= rate;
5935
5936 if (percent <= 0.0f)
5937 return 0;
5938
5939 // Multiply result with the faction specific rate
5940 if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
5941 {
5942 float repRate = 0.0f;
5943 switch (source)
5944 {
5946 repRate = repData->creatureRate;
5947 break;
5949 repRate = repData->questRate;
5950 break;
5952 repRate = repData->questDailyRate;
5953 break;
5955 repRate = repData->questWeeklyRate;
5956 break;
5958 repRate = repData->questMonthlyRate;
5959 break;
5961 repRate = repData->questRepeatableRate;
5962 break;
5964 repRate = repData->spellRate;
5965 break;
5966 }
5967
5968 // for custom, a rate of 0.0 will totally disable reputation gain for this faction/type
5969 if (repRate <= 0.0f)
5970 return 0;
5971
5972 percent *= repRate;
5973 }
5974
5975 if (source != REPUTATION_SOURCE_SPELL && GetsRecruitAFriendBonus(false))
5976 percent *= 1.0f + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS);
5977
5978 return CalculatePct(rep, percent);
5979}
@ REPUTATION_SOURCE_KILL
Definition Player.h:240
@ REPUTATION_SOURCE_SPELL
Definition Player.h:246
@ REPUTATION_SOURCE_QUEST
Definition Player.h:241
@ REPUTATION_SOURCE_MONTHLY_QUEST
Definition Player.h:244
@ REPUTATION_SOURCE_REPEATABLE_QUEST
Definition Player.h:245
@ REPUTATION_SOURCE_WEEKLY_QUEST
Definition Player.h:243
@ REPUTATION_SOURCE_DAILY_QUEST
Definition Player.h:242
@ SPELL_AURA_MOD_REPUTATION_GAIN
Definition SpellAuraDefines.h:219
@ SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
Definition SpellAuraDefines.h:253
@ RATE_REPUTATION_LOWLEVEL_QUEST
Definition WorldConfig.h:435
@ RATE_REPUTATION_LOWLEVEL_KILL
Definition WorldConfig.h:434
@ RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS
Definition WorldConfig.h:436
bool GetsRecruitAFriendBonus(bool forXP)
Definition Player.cpp:12654
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6101
uint8 GetGrayLevel(uint8 pl_level)
Definition Formulas.h:46
Definition ObjectMgr.h:557

References CalculatePct(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), GetsRecruitAFriendBonus(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierByMiscValue(), RATE_REPUTATION_LOWLEVEL_KILL, RATE_REPUTATION_LOWLEVEL_QUEST, RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, REPUTATION_SOURCE_DAILY_QUEST, REPUTATION_SOURCE_KILL, REPUTATION_SOURCE_MONTHLY_QUEST, REPUTATION_SOURCE_QUEST, REPUTATION_SOURCE_REPEATABLE_QUEST, REPUTATION_SOURCE_SPELL, REPUTATION_SOURCE_WEEKLY_QUEST, sObjectMgr, SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, SPELL_AURA_MOD_REPUTATION_GAIN, and sWorld.

Referenced by Spell::EffectReputation(), RewardReputation(), and RewardReputation().

◆ CalculateTalentsPoints()

uint32 Player::CalculateTalentsPoints ( ) const
13586{
13587 uint32 base_talent = GetLevel() < 10 ? 0 : GetLevel() - 9;
13588
13589 uint32 talentPointsForLevel = 0;
13591 {
13592 talentPointsForLevel = base_talent;
13593 }
13594 else
13595 {
13596 talentPointsForLevel = GetLevel() < 56 ? 0 : GetLevel() - 55;
13597 talentPointsForLevel += m_questRewardTalentCount;
13598
13599 if (talentPointsForLevel > base_talent)
13600 {
13601 talentPointsForLevel = base_talent;
13602 }
13603 }
13604
13605 talentPointsForLevel += m_extraBonusTalentCount;
13606 sScriptMgr->OnPlayerCalculateTalentsPoints(this, talentPointsForLevel);
13607 return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
13608}
@ MAP_EBON_HOLD
Definition AreaDefines.h:258
@ CLASS_CONTEXT_TALENT_POINT_CALC
Definition UnitDefines.h:233
@ RATE_TALENT
Definition WorldConfig.h:463

References CLASS_CONTEXT_TALENT_POINT_CALC, CLASS_DEATH_KNIGHT, Unit::GetLevel(), WorldLocation::GetMapId(), IsClass(), m_extraBonusTalentCount, m_questRewardTalentCount, MAP_EBON_HOLD, RATE_TALENT, sScriptMgr, and sWorld.

Referenced by InitTalentForLevel(), and resetTalents().

◆ CanAddQuest()

bool Player::CanAddQuest ( Quest const *  quest,
bool  msg 
)
265{
266 if (!SatisfyQuestLog(msg))
267 return false;
268
269 uint32 srcitem = quest->GetSrcItemId();
270 if (srcitem > 0)
271 {
272 uint32 count = quest->GetSrcItemCount();
273 ItemPosCountVec dest;
274 InventoryResult msg2 = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count);
275
276 // player already have max number (in most case 1) source item, no additional item needed and quest can be added.
278 return true;
279 else if (msg2 != EQUIP_ERR_OK)
280 {
281 SendEquipError(msg2, nullptr, nullptr, srcitem);
282 PlayDirectSound(QUEST_SOUND_FAILURE, this); // Play failure sound
283 return false;
284 }
285 }
286 return true;
287}
@ EQUIP_ERR_CANT_CARRY_MORE_OF_THIS
Definition Item.h:64
@ QUEST_SOUND_FAILURE
Definition Player.h:251
bool SatisfyQuestLog(bool msg)
Definition PlayerQuest.cpp:984
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition Object.cpp:2866

References CanStoreNewItem(), EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), NULL_BAG, NULL_SLOT, WorldObject::PlayDirectSound(), QUEST_SOUND_FAILURE, SatisfyQuestLog(), and SendEquipError().

Referenced by Spell::EffectQuestStart(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), and SendPreparedQuest().

◆ CanAlwaysSee()

bool Player::CanAlwaysSee ( WorldObject const *  obj) const
overrideprotectedvirtual

Reimplemented from WorldObject.

11422{
11423 // Always can see self
11424 if (m_mover == obj)
11425 return true;
11426
11428 if (obj->GetGUID() == guid)
11429 return true;
11430
11431 return false;
11432}
@ PLAYER_FARSIGHT
Definition UpdateFields.h:334

References Object::GetGUID(), Object::GetGuidValue(), m_mover, and PLAYER_FARSIGHT.

◆ CanBankItem()

InventoryResult Player::CanBankItem ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
Item pItem,
bool  swap,
bool  not_loading = true 
) const
2033{
2034 if (!pItem)
2036
2037 uint32 count = pItem->GetCount();
2038
2039 LOG_DEBUG("entities.player.items", "STORAGE: CanBankItem bag = {}, slot = {}, item = {}, count = {}", bag, slot, pItem->GetEntry(), pItem->GetCount());
2040 ItemTemplate const* pProto = pItem->GetTemplate();
2041 if (!pProto)
2043
2044 // Xinef: Removed next loot generated check
2045 if (pItem->GetGUID() == GetLootGUID())
2047
2048 if (pItem->IsBindedNotWith(this))
2050
2051 // Currency tokens are not supposed to be swapped out of their hidden bag
2052 uint8 pItemslot = pItem->GetSlot();
2053 if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END)
2054 {
2055 LOG_ERROR("entities.player", "Possible hacking attempt: Player {} [{}] tried to move token [{}, entry: {}] out of the currency bag!",
2056 GetName(), GetGUID().ToString(), pItem->GetGUID().ToString(), pProto->ItemId);
2058 }
2059
2060 // check count of items (skip for auto move for same player from bank)
2062 if (res != EQUIP_ERR_OK)
2063 return res;
2064
2065 // in specific slot
2066 if (bag != NULL_BAG && slot != NULL_SLOT)
2067 {
2068 if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
2069 {
2070 if (!pItem->IsBag())
2072
2075
2076 res = CanUseItem(pItem, not_loading);
2077 if (res != EQUIP_ERR_OK)
2078 return res;
2079 }
2080
2081 res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
2082 if (res != EQUIP_ERR_OK)
2083 return res;
2084
2085 if (count == 0)
2086 return EQUIP_ERR_OK;
2087 }
2088
2089 // not specific slot or have space for partly store only in specific slot
2090
2091 // in specific bag
2092 if (bag != NULL_BAG)
2093 {
2094 if (pItem->IsNotEmptyBag())
2096
2097 // search stack in bag for merge to
2098 if (pProto->Stackable != 1)
2099 {
2100 if (bag == INVENTORY_SLOT_BAG_0)
2101 {
2102 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
2103 if (res != EQUIP_ERR_OK)
2104 return res;
2105
2106 if (count == 0)
2107 return EQUIP_ERR_OK;
2108 }
2109 else
2110 {
2111 res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
2112 if (res != EQUIP_ERR_OK)
2113 res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
2114
2115 if (res != EQUIP_ERR_OK)
2116 return res;
2117
2118 if (count == 0)
2119 return EQUIP_ERR_OK;
2120 }
2121 }
2122
2123 // search free slot in bag
2124 if (bag == INVENTORY_SLOT_BAG_0)
2125 {
2126 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
2127 if (res != EQUIP_ERR_OK)
2128 return res;
2129
2130 if (count == 0)
2131 return EQUIP_ERR_OK;
2132 }
2133 else
2134 {
2135 res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
2136 if (res != EQUIP_ERR_OK)
2137 res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
2138
2139 if (res != EQUIP_ERR_OK)
2140 return res;
2141
2142 if (count == 0)
2143 return EQUIP_ERR_OK;
2144 }
2145 }
2146
2147 // not specific bag or have space for partly store only in specific bag
2148
2149 // search stack for merge to
2150 if (pProto->Stackable != 1)
2151 {
2152 // in slots
2153 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
2154 if (res != EQUIP_ERR_OK)
2155 return res;
2156
2157 if (count == 0)
2158 return EQUIP_ERR_OK;
2159
2160 // in special bags
2161 if (pProto->BagFamily)
2162 {
2163 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2164 {
2165 res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
2166 if (res != EQUIP_ERR_OK)
2167 continue;
2168
2169 if (count == 0)
2170 return EQUIP_ERR_OK;
2171 }
2172 }
2173
2174 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2175 {
2176 res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
2177 if (res != EQUIP_ERR_OK)
2178 continue;
2179
2180 if (count == 0)
2181 return EQUIP_ERR_OK;
2182 }
2183 }
2184
2185 // search free place in special bag
2186 if (pProto->BagFamily)
2187 {
2188 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2189 {
2190 res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
2191 if (res != EQUIP_ERR_OK)
2192 continue;
2193
2194 if (count == 0)
2195 return EQUIP_ERR_OK;
2196 }
2197 }
2198
2199 // search free space
2200 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
2201 if (res != EQUIP_ERR_OK)
2202 return res;
2203
2204 if (count == 0)
2205 return EQUIP_ERR_OK;
2206
2207 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2208 {
2209 res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
2210 if (res != EQUIP_ERR_OK)
2211 continue;
2212
2213 if (count == 0)
2214 return EQUIP_ERR_OK;
2215 }
2216 return EQUIP_ERR_BANK_FULL;
2217}
@ EQUIP_ERR_ALREADY_LOOTED
Definition Item.h:96
@ EQUIP_ERR_DONT_OWN_THAT_ITEM
Definition Item.h:79
@ EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT
Definition Item.h:81
@ EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG
Definition Item.h:52
@ EQUIP_ERR_BANK_FULL
Definition Item.h:98
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition Item.h:70
@ EQUIP_ERR_ITEMS_CANT_BE_SWAPPED
Definition Item.h:68
@ BANK_SLOT_BAG_START
Definition Player.h:724
@ BANK_SLOT_ITEM_START
Definition Player.h:718
@ BANK_SLOT_ITEM_END
Definition Player.h:719
bool IsBindedNotWith(Player const *player) const
Definition Item.cpp:1132
bool IsBag() const
Definition Item.h:254
bool IsNotEmptyBag() const
Definition Item.cpp:311
uint8 GetBankBagSlotCount() const
Definition Player.h:1287
ObjectGuid GetLootGUID() const
Definition Player.h:2011
InventoryResult CanTakeMoreSimilarItems(Item *pItem) const
Definition Player.h:1294
InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
Definition PlayerStorage.cpp:1050
InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
Definition PlayerStorage.cpp:980
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool swap, Item *pSrcItem) const
Definition PlayerStorage.cpp:909
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition PlayerStorage.cpp:2219
uint32 BagFamily
Definition ItemTemplate.h:679
int32 Stackable
Definition ItemTemplate.h:645

References ItemTemplate::BagFamily, BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanTakeMoreSimilarItems(), CanUseItem(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_BANK_FULL, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, GetBankBagSlotCount(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), GetLootGUID(), WorldObject::GetName(), Item::GetSlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, Item::IsBag(), Item::IsBindedNotWith(), Item::IsNotEmptyBag(), ItemTemplate::ItemId, LOG_DEBUG, LOG_ERROR, NULL_BAG, NULL_SLOT, ItemTemplate::Stackable, ObjectGuid::ToString(), and Position::ToString().

Referenced by _LoadInventory(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), SplitItem(), and SwapItem().

◆ CanBlock()

bool Player::CanBlock ( ) const
inline
2203{ return m_canBlock; }

References m_canBlock.

Referenced by UpdateBlockPercentage().

◆ CanCaptureTowerPoint()

bool Player::CanCaptureTowerPoint ( ) const
13208{
13209 return (!HasStealthAura() && // not stealthed
13210 !HasInvisibilityAura() && // not invisible
13211 IsAlive() // live player
13212 );
13213}
bool HasStealthAura() const
Definition Unit.h:1755
bool HasInvisibilityAura() const
Definition Unit.h:1757

References Unit::HasInvisibilityAura(), Unit::HasStealthAura(), and Unit::IsAlive().

◆ CanCompleteQuest()

bool Player::CanCompleteQuest ( uint32  quest_id,
const QuestStatusData q_savedStatus = nullptr 
)
290{
291 if (quest_id)
292 {
293 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
294 if (!qInfo)
295 return false;
296
297 // Xinef: take seasonals into account
298 if (!qInfo->IsRepeatable() && !qInfo->IsSeasonal() && IsQuestRewarded(quest_id))
299 return false; // not allow re-complete quest
300
301 // auto complete quest
302 if ((qInfo->IsAutoComplete() || !qInfo->GetQuestMethod()) && CanTakeQuest(qInfo, false))
303 return true;
304
305 QuestStatusData q_status;
306 if (q_savedStatus)
307 q_status = *q_savedStatus;
308 else
309 {
310 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
311 if (itr == m_QuestStatus.end())
312 return false;
313
314 q_status = itr->second;
315 }
316
317 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
318 {
320 {
321 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
322 {
323 if (qInfo->RequiredItemCount[i] != 0 && q_status.ItemCount[i] < qInfo->RequiredItemCount[i])
324 return false;
325 }
326 }
327
329 {
330 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
331 {
332 if (qInfo->RequiredNpcOrGo[i] == 0)
333 continue;
334
335 if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] < qInfo->RequiredNpcOrGoCount[i])
336 return false;
337 }
338 }
339
341 if (qInfo->GetPlayersSlain() != 0 && q_status.PlayerCount < qInfo->GetPlayersSlain())
342 return false;
343
345 return false;
346
347 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED) && q_status.Timer == 0)
348 return false;
349
350 if (qInfo->GetRewOrReqMoney() < 0)
351 {
352 if (!HasEnoughMoney(-qInfo->GetRewOrReqMoney()))
353 return false;
354 }
355
356 uint32 repFacId = qInfo->GetRepObjectiveFaction();
357 if (repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue())
358 return false;
359
360 return true;
361 }
362 }
363 return false;
364}
@ QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT
Definition QuestDef.h:161
bool CanTakeQuest(Quest const *quest, bool msg)
Definition PlayerQuest.cpp:251
uint32 GetReputation(uint32 factionentry) const
Definition Player.cpp:15306
bool IsQuestRewarded(uint32 quest_id) const
Definition Player.h:1643
bool HasSpecialFlag(uint32 flag) const
Definition QuestDef.h:224
int32 GetRepObjectiveValue() const
Definition QuestDef.h:240
int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]
Definition QuestDef.h:304
uint32 GetRepObjectiveFaction() const
Definition QuestDef.h:239
uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT]
Definition QuestDef.h:305
bool IsRepeatable() const
Definition QuestDef.h:283
bool IsAutoComplete() const
Definition QuestDef.cpp:274
uint32 GetPlayersSlain() const
Definition QuestDef.h:254
uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT]
Definition QuestDef.h:301
int32 GetRewOrReqMoney(uint8 playerLevel=0) const
Definition QuestDef.cpp:238
bool IsSeasonal() const
Definition QuestDef.h:290
uint32 GetQuestMethod() const
Definition QuestDef.h:229

References CanTakeQuest(), QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, Quest::GetPlayersSlain(), Quest::GetQuestMethod(), Quest::GetRepObjectiveFaction(), Quest::GetRepObjectiveValue(), GetReputation(), GetReputationMgr(), Quest::GetRewOrReqMoney(), HasEnoughMoney(), Quest::HasSpecialFlag(), Quest::IsAutoComplete(), IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), QuestStatusData::ItemCount, m_QuestStatus, QuestStatusData::PlayerCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, sObjectMgr, QuestStatusData::Status, and QuestStatusData::Timer.

Referenced by AddQuestAndCheckCompletion(), AreaExploredOrEventHappens(), WorldSession::HandleQuestgiverQueryQuestOpcode(), WorldSession::HandleQuestgiverRequestRewardOpcode(), ItemAddedQuestCheck(), KillCreditGO(), KilledMonsterCredit(), KilledPlayerCreditForQuest(), MoneyChanged(), ReputationChanged(), ReputationChanged2(), PlayerMenu::SendQuestGiverRequestItems(), and TalkedToCreature().

◆ CanCompleteRepeatableQuest()

bool Player::CanCompleteRepeatableQuest ( Quest const *  quest)
367{
368 // Solve problem that player don't have the quest and try complete it.
369 // if repeatable she must be able to complete event if player don't have it.
370 // Seem that all repeatable quest are DELIVER Flag so, no need to add more.
371 if (!CanTakeQuest(quest, false))
372 return false;
373
374 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
375 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
376 if (quest->RequiredItemId[i] && quest->RequiredItemCount[i] && !HasItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i]))
377 return false;
378
379 if (!CanRewardQuest(quest, false))
380 return false;
381
382 return true;
383}
bool CanRewardQuest(Quest const *quest, bool msg)
Definition PlayerQuest.cpp:385

References CanRewardQuest(), CanTakeQuest(), HasItemCount(), Quest::HasSpecialFlag(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, and Quest::RequiredItemId.

Referenced by WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverCompleteQuest(), and SendPreparedQuest().

◆ CanEnterWater()

bool Player::CanEnterWater ( ) const
inlineoverridevirtual

Implements Unit.

2587{ return true; }

◆ CanEquipItem()

InventoryResult Player::CanEquipItem ( uint8  slot,
uint16 dest,
Item pItem,
bool  swap,
bool  not_loading = true 
) const
1806{
1807 dest = 0;
1808 if (pItem)
1809 {
1810 LOG_DEBUG("entities.player.items", "STORAGE: CanEquipItem slot = {}, item = {}, count = {}", slot, pItem->GetEntry(), pItem->GetCount());
1811 ItemTemplate const* pProto = pItem->GetTemplate();
1812 if (pProto)
1813 {
1814 if (!sScriptMgr->OnPlayerCanEquipItem(const_cast<Player*>(this), slot, dest, pItem, swap, not_loading))
1816
1817 // item used
1818 if (pItem->m_lootGenerated)
1820
1821 if (pItem->IsBindedNotWith(this))
1823
1824 // check count of items (skip for auto move for same player from bank)
1826 if (res != EQUIP_ERR_OK)
1827 return res;
1828
1829 // check this only in game
1830 if (not_loading)
1831 {
1832 // May be here should be more stronger checks; STUNNED checked
1833 // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
1836
1837 // do not allow equipping gear except weapons, offhands, projectiles, relics in
1838 // - combat
1839 // - in-progress arenas
1840 if (!pProto->CanChangeEquipStateInCombat())
1841 {
1842 if (IsInCombat())
1844
1845 if (Battleground* bg = GetBattleground())
1846 if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
1848 }
1849
1850 if (IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer != 0)
1851 return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
1852
1853 if (IsNonMeleeSpellCast(false))
1855 }
1856
1858 // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
1859 if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < GetLevel())
1861
1862 uint8 eslot = FindEquipSlot(pProto, slot, swap);
1863 if (eslot == NULL_SLOT)
1865
1866 // Xinef: dont allow to equip items on disarmed slot
1867 if (!CanUseAttackType(GetAttackBySlot(eslot)))
1869
1870 res = CanUseItem(pItem, not_loading);
1871 if (res != EQUIP_ERR_OK)
1872 return res;
1873
1874 if (!swap && GetItemByPos(INVENTORY_SLOT_BAG_0, eslot))
1876
1877 // if we are swapping 2 equipped items, CanEquipUniqueItem check
1878 // should ignore the item we are trying to swap, and not the
1879 // destination item. CanEquipUniqueItem should ignore destination
1880 // item only when we are swapping weapon from bag
1881 uint8 ignore = uint8(NULL_SLOT);
1882 switch (eslot)
1883 {
1885 ignore = EQUIPMENT_SLOT_OFFHAND;
1886 break;
1888 ignore = EQUIPMENT_SLOT_MAINHAND;
1889 break;
1891 ignore = EQUIPMENT_SLOT_FINGER2;
1892 break;
1894 ignore = EQUIPMENT_SLOT_FINGER1;
1895 break;
1897 ignore = EQUIPMENT_SLOT_TRINKET2;
1898 break;
1900 ignore = EQUIPMENT_SLOT_TRINKET1;
1901 break;
1902 }
1903
1904 if (ignore == uint8(NULL_SLOT) || pItem != GetItemByPos(INVENTORY_SLOT_BAG_0, ignore))
1905 ignore = eslot;
1906
1907 InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? ignore : uint8(NULL_SLOT));
1908 if (res2 != EQUIP_ERR_OK)
1909 return res2;
1910
1911 // check unique-equipped special item classes
1912 if (pProto->Class == ITEM_CLASS_QUIVER)
1914 if (Item* pBag = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1915 if (pBag != pItem)
1916 if (ItemTemplate const* pBagProto = pBag->GetTemplate())
1917 if (pBagProto->Class == pProto->Class && (!swap || pBag->GetSlot() != eslot))
1918 return (pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH)
1921
1922 uint32 type = pProto->InventoryType;
1923
1924 if (eslot == EQUIPMENT_SLOT_OFFHAND)
1925 {
1926 // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
1927 // xinef: same for fishing poles
1930
1931 else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
1932 {
1933 if (!CanDualWield())
1935 }
1936 else if (type == INVTYPE_2HWEAPON)
1937 {
1938 if (!CanDualWield() || !CanTitanGrip())
1940 }
1941
1942 // Do not allow offhand with main hand polearm, staff or fishing pole
1944 if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
1945 if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
1946 mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
1947 mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
1949
1950 if (IsTwoHandUsed())
1952 }
1953
1954 // equip two-hand weapon case (with possible unequip 2 items)
1955 if (type == INVTYPE_2HWEAPON)
1956 {
1957 if (eslot == EQUIPMENT_SLOT_OFFHAND)
1958 {
1959 if (!CanTitanGrip())
1961 }
1962 else if (eslot != EQUIPMENT_SLOT_MAINHAND)
1964
1966 {
1967 // offhand item must can be stored in inventory for offhand item and it also must be unequipped
1969 ItemPosCountVec off_dest;
1970 if (offItem && (!not_loading ||
1972 CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK))
1974 }
1975 }
1976 dest = ((INVENTORY_SLOT_BAG_0 << 8) | eslot);
1977 return EQUIP_ERR_OK;
1978 }
1979 }
1980
1982}
@ STATUS_IN_PROGRESS
Definition Battleground.h:193
#define DEFAULT_MAX_LEVEL
Definition DBCEnums.h:35
@ INVTYPE_RELIC
Definition ItemTemplate.h:284
@ ITEM_SUBCLASS_AMMO_POUCH
Definition ItemTemplate.h:481
@ ITEM_CLASS_QUIVER
Definition ItemTemplate.h:302
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH
Definition Item.h:89
@ EQUIP_ERR_CANT_DUAL_WIELD
Definition Item.h:61
@ EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE
Definition Item.h:56
@ EQUIP_ERR_NOT_DURING_ARENA_MATCH
Definition Item.h:124
@ EQUIP_ERR_NOT_IN_COMBAT
Definition Item.h:107
@ EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED
Definition Item.h:60
@ EQUIP_ERR_NOT_WHILE_DISARMED
Definition Item.h:108
@ EQUIP_ERR_CANT_DO_RIGHT_NOW
Definition Item.h:86
@ EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER
Definition Item.h:80
@ EQUIP_ERR_YOU_ARE_STUNNED
Definition Item.h:84
@ EQUIP_ERR_INVENTORY_FULL
Definition Item.h:97
@ EQUIPMENT_SLOT_FINGER1
Definition Player.h:692
@ EQUIPMENT_SLOT_FINGER2
Definition Player.h:693
@ EQUIPMENT_SLOT_TRINKET1
Definition Player.h:694
@ EQUIPMENT_SLOT_TRINKET2
Definition Player.h:695
Definition Battleground.h:294
bool m_lootGenerated
Definition Item.h:321
Definition Player.h:1083
InventoryResult CanUnequipItem(uint16 src, bool swap) const
Definition PlayerStorage.cpp:1984
InventoryResult CanEquipUniqueItem(Item *pItem, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
Definition Player.cpp:13756
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12165
uint8 FindEquipSlot(ItemTemplate const *proto, uint32 slot, bool swap) const
Definition PlayerStorage.cpp:125
bool CanChangeEquipStateInCombat() const
Definition ItemTemplate.h:706
uint32 ScalingStatDistribution
Definition ItemTemplate.h:649
uint32 SubClass
Definition ItemTemplate.h:622

References ItemTemplate::CanChangeEquipStateInCombat(), Unit::CanDualWield(), CanEquipUniqueItem(), CanStoreItem(), CanTakeMoreSimilarItems(), CanTitanGrip(), CanUnequipItem(), Unit::CanUseAttackType(), CanUseItem(), ItemTemplate::Class, DEFAULT_MAX_LEVEL, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH, EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_DUAL_WIELD, EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE, EQUIP_ERR_NOT_DURING_ARENA_MATCH, EQUIP_ERR_NOT_IN_COMBAT, EQUIP_ERR_NOT_WHILE_DISARMED, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_STUNNED, EQUIPMENT_SLOT_FINGER1, EQUIPMENT_SLOT_FINGER2, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_TRINKET1, EQUIPMENT_SLOT_TRINKET2, FindEquipSlot(), GetAttackBySlot(), GetBattleground(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), Unit::GetLevel(), Item::GetTemplate(), Unit::HasUnitState(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_RELIC, INVTYPE_WEAPON, INVTYPE_WEAPONOFFHAND, Item::IsBindedNotWith(), Unit::IsInCombat(), Unit::IsNonMeleeSpellCast(), IsTwoHandUsed(), ITEM_CLASS_QUIVER, ITEM_CLASS_WEAPON, ITEM_SUBCLASS_AMMO_POUCH, ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_POLEARM, ITEM_SUBCLASS_WEAPON_STAFF, LOG_DEBUG, Item::m_lootGenerated, m_weaponChangeTimer, ScalingStatDistributionEntry::MaxLevel, NULL_BAG, NULL_SLOT, ItemTemplate::ScalingStatDistribution, sScalingStatDistributionStore, sScriptMgr, STATUS_IN_PROGRESS, ItemTemplate::SubClass, and UNIT_STATE_STUNNED.

Referenced by _LoadInventory(), CanEquipNewItem(), Create(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleEquipmentSetUse(), SplitItem(), and SwapItem().

◆ CanEquipNewItem()

InventoryResult Player::CanEquipNewItem ( uint8  slot,
uint16 dest,
uint32  item,
bool  swap 
) const
1792{
1793 dest = 0;
1794 Item* pItem = Item::CreateItem(item, 1, this);
1795 if (pItem)
1796 {
1797 InventoryResult result = CanEquipItem(slot, dest, pItem, swap);
1798 delete pItem;
1799 return result;
1800 }
1801
1803}
static Item * CreateItem(uint32 item, uint32 count, Player const *player=nullptr, bool clone=false, uint32 randomPropertyId=0)
Definition Item.cpp:1087

References CanEquipItem(), Item::CreateItem(), and EQUIP_ERR_ITEM_NOT_FOUND.

Referenced by _StoreOrEquipNewItem(), and StoreNewItemInBestSlots().

◆ CanEquipUniqueItem() [1/2]

InventoryResult Player::CanEquipUniqueItem ( Item pItem,
uint8  except_slot = NULL_SLOT,
uint32  limit_count = 1 
) const
13757{
13758 ItemTemplate const* pProto = pItem->GetTemplate();
13759
13760 // proto based limitations
13761 if (InventoryResult res = CanEquipUniqueItem(pProto, eslot, limit_count))
13762 return res;
13763
13764 // check unique-equipped on gems
13765 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
13766 {
13767 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
13768 if (!enchant_id)
13769 continue;
13770 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
13771 if (!enchantEntry)
13772 continue;
13773
13774 ItemTemplate const* pGem = sObjectMgr->GetItemTemplate(enchantEntry->GemID);
13775 if (!pGem)
13776 continue;
13777
13778 // include for check equip another gems with same limit category for not equipped item (and then not counted)
13779 uint32 gem_limit_count = !pItem->IsEquipped() && pGem->ItemLimitCategory
13781
13782 if (InventoryResult res = CanEquipUniqueItem(pGem, eslot, gem_limit_count))
13783 return res;
13784 }
13785
13786 return EQUIP_ERR_OK;
13787}
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const
Definition Item.cpp:1033
uint32 ItemLimitCategory
Definition ItemTemplate.h:687
uint32 GemID
Definition DBCStructure.h:1853

References CanEquipUniqueItem(), EQUIP_ERR_OK, SpellItemEnchantmentEntry::GemID, Item::GetEnchantmentId(), Item::GetGemCountWithLimitCategory(), Item::GetTemplate(), Item::IsEquipped(), ItemTemplate::ItemLimitCategory, sObjectMgr, SOCK_ENCHANTMENT_SLOT, and sSpellItemEnchantmentStore.

Referenced by CanEquipItem(), CanEquipUniqueItem(), and WorldSession::HandleSocketOpcode().

◆ CanEquipUniqueItem() [2/2]

InventoryResult Player::CanEquipUniqueItem ( ItemTemplate const *  itemProto,
uint8  except_slot = NULL_SLOT,
uint32  limit_count = 1 
) const
13790{
13791 // check unique-equipped on item
13792 if (itemProto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
13793 {
13794 // there is an equip limit on this item
13795 if (HasItemOrGemWithIdEquipped(itemProto->ItemId, 1, except_slot))
13797 }
13798
13799 // check unique-equipped limit
13800 if (itemProto->ItemLimitCategory)
13801 {
13802 ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(itemProto->ItemLimitCategory);
13803 if (!limitEntry)
13805
13806 // NOTE: limitEntry->mode not checked because if item have have-limit then it applied and to equip case
13807
13808 if (limit_count > limitEntry->maxCount)
13810
13811 // there is an equip limit on this item
13812 if (HasItemOrGemWithLimitCategoryEquipped(itemProto->ItemLimitCategory, limitEntry->maxCount - limit_count + 1, except_slot))
13814 }
13815
13816 return EQUIP_ERR_OK;
13817}
DBCStorage< ItemLimitCategoryEntry > sItemLimitCategoryStore(ItemLimitCategoryEntryfmt)
@ ITEM_FLAG_UNIQUE_EQUIPPABLE
Definition ItemTemplate.h:166
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED
Definition Item.h:135
@ EQUIP_ERR_ITEM_UNIQUE_EQUIPABLE
Definition Item.h:114
@ EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED
Definition Item.h:121
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot=NULL_SLOT) const
Definition PlayerStorage.cpp:728
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot=NULL_SLOT) const
Definition PlayerStorage.cpp:766
Definition DBCStructure.h:1197
uint32 maxCount
Definition DBCStructure.h:1201

References EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED, EQUIP_ERR_ITEM_UNIQUE_EQUIPABLE, EQUIP_ERR_OK, ItemTemplate::HasFlag(), HasItemOrGemWithIdEquipped(), HasItemOrGemWithLimitCategoryEquipped(), ITEM_FLAG_UNIQUE_EQUIPPABLE, ItemTemplate::ItemId, ItemTemplate::ItemLimitCategory, ItemLimitCategoryEntry::maxCount, and sItemLimitCategoryStore.

◆ CanExecutePendingSpellCastRequest()

bool Player::CanExecutePendingSpellCastRequest ( SpellInfo const *  spellInfo)
2314{
2315 if (GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
2316 return false;
2317
2318 if (GetSpellCooldownDelay(spellInfo->Id) > GetSpellQueueWindow())
2319 return false;
2320
2322 if (Spell* spell = GetCurrentSpell(spellSlot))
2323 {
2324 bool autoshot = spell->m_spellInfo->IsAutoRepeatRangedSpell();
2325 if (IsNonMeleeSpellCast(false, true, true, autoshot))
2326 return false;
2327 }
2328 return true;
2329}
CurrentSpellTypes
Definition Unit.h:537
@ CURRENT_MELEE_SPELL
Definition Unit.h:538
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition Player.h:1818
uint32 GetSpellQueueWindow() const
Definition PlayerUpdates.cpp:2308
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition Player.cpp:16312

References CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, Unit::GetCurrentSpell(), GetGlobalCooldownMgr(), GetSpellCooldownDelay(), GetSpellQueueWindow(), SpellInfo::Id, and Unit::IsNonMeleeSpellCast().

Referenced by WorldSession::HandleCastSpellOpcode(), WorldSession::HandleUseItemOpcode(), and ProcessSpellQueue().

◆ CanFly()

bool Player::CanFly ( ) const
inlineoverridevirtual

Implements Unit.

@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:389
MovementInfo m_movementInfo
Definition Object.h:679
bool HasMovementFlag(uint32 flag) const
Definition Object.h:346

References MovementInfo::HasMovementFlag(), WorldObject::m_movementInfo, and MOVEMENTFLAG_CAN_FLY.

Referenced by gm_commandscript::HandleGMFlyCommand().

◆ canFlyInZone()

bool Player::canFlyInZone ( uint32  mapid,
uint32  zone,
SpellInfo const *  bySpell 
)
13611{
13612 if (!sScriptMgr->OnPlayerCanFlyInZone(this, mapid,zone,bySpell))
13613 {
13614 return false;
13615 }
13616
13617 // continent checked in SpellInfo::CheckLocation at cast and area update
13618 uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
13619 if (v_map == MAP_NORTHREND && !bySpell->HasAttribute(SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT))
13620 {
13621 if (!HasSpell(54197)) // 54197 = Cold Weather Flying
13622 {
13623 return false;
13624 }
13625 }
13626
13627 return true;
13628}
@ MAP_NORTHREND
Definition AreaDefines.h:242
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition DBCStores.cpp:703
@ SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT
Definition SharedDefines.h:663

References GetVirtualMapForMapAndZone(), SpellInfo::HasAttribute(), HasSpell(), MAP_NORTHREND, SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT, and sScriptMgr.

Referenced by SpellInfo::CheckLocation().

◆ CanInteractWithQuestGiver()

bool Player::CanInteractWithQuestGiver ( Object questGiver)
2072{
2073 switch (questGiver->GetTypeId())
2074 {
2075 case TYPEID_UNIT:
2076 return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != nullptr;
2077 case TYPEID_GAMEOBJECT:
2078 return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != nullptr;
2079 case TYPEID_PLAYER:
2080 return IsAlive() && questGiver->ToPlayer()->IsAlive();
2081 case TYPEID_ITEM:
2082 return IsAlive();
2083 default:
2084 break;
2085 }
2086 return false;
2087}
@ GAMEOBJECT_TYPE_QUESTGIVER
Definition SharedDefines.h:1562
@ UNIT_NPC_FLAG_QUESTGIVER
Definition UnitDefines.h:316
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const
Definition Player.cpp:2146

References GAMEOBJECT_TYPE_QUESTGIVER, GetGameObjectIfCanInteractWith(), Object::GetGUID(), GetNPCIfCanInteractWith(), Object::GetTypeId(), Unit::IsAlive(), Object::ToPlayer(), TYPEID_GAMEOBJECT, TYPEID_ITEM, TYPEID_PLAYER, TYPEID_UNIT, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), and WorldSession::HandleQuestgiverRequestRewardOpcode().

◆ CanJoinConstantChannelInZone()

bool Player::CanJoinConstantChannelInZone ( ChatChannelsEntry const *  channel,
AreaTableEntry const *  zone 
)
5008{
5009 // Player can join LFG anywhere
5010 if (channel->flags & CHANNEL_DBC_FLAG_LFG && sWorld->getBoolConfig(CONFIG_LFG_LOCATION_ALL))
5011 return true;
5012
5013 if (channel->flags & CHANNEL_DBC_FLAG_ZONE_DEP && zone->flags & AREA_FLAG_ARENA_INSTANCE)
5014 return false;
5015
5016 if ((channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY) && (!(zone->flags & AREA_FLAG_SLAVE_CAPITAL)))
5017 return false;
5018
5019 if ((channel->flags & CHANNEL_DBC_FLAG_GUILD_REQ) && GetGuildId())
5020 return false;
5021
5022 return true;
5023}
@ CHANNEL_DBC_FLAG_CITY_ONLY
Definition Channel.h:97
@ CHANNEL_DBC_FLAG_GUILD_REQ
Definition Channel.h:100
@ CHANNEL_DBC_FLAG_ZONE_DEP
Definition Channel.h:94
@ CHANNEL_DBC_FLAG_LFG
Definition Channel.h:101
@ AREA_FLAG_ARENA_INSTANCE
Definition DBCEnums.h:250
@ AREA_FLAG_SLAVE_CAPITAL
Definition DBCEnums.h:237
@ CONFIG_LFG_LOCATION_ALL
Definition WorldConfig.h:115
uint32 GetGuildId() const
Definition Player.h:1914

References AREA_FLAG_ARENA_INSTANCE, AREA_FLAG_SLAVE_CAPITAL, CHANNEL_DBC_FLAG_CITY_ONLY, CHANNEL_DBC_FLAG_GUILD_REQ, CHANNEL_DBC_FLAG_LFG, CHANNEL_DBC_FLAG_ZONE_DEP, CONFIG_LFG_LOCATION_ALL, AreaTableEntry::flags, ChatChannelsEntry::flags, GetGuildId(), and sWorld.

Referenced by UpdateLocalChannels().

◆ CanJoinToBattleground()

bool Player::CanJoinToBattleground ( ) const
11338{
11339 // check Deserter debuff
11340 if (HasAura(26013))
11341 return false;
11342
11343 return true;
11344}
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5777

References Unit::HasAura().

Referenced by Group::CanJoinBattlegroundQueue(), WorldSession::HandleBattleFieldPortOpcode(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ CanKnockback()

bool Player::CanKnockback ( )
inline
2516{ return m_canKnockback; }

References m_canKnockback.

◆ CanNoReagentCast()

bool Player::CanNoReagentCast ( SpellInfo const *  spellInfo) const
12533{
12534 // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA
12536 return true;
12537
12538 // Check no reagent use mask
12539 flag96 noReagentMask;
12540 noReagentMask[0] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1);
12541 noReagentMask[1] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1);
12542 noReagentMask[2] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2);
12543 if (spellInfo->SpellFamilyFlags & noReagentMask)
12544 return true;
12545
12546 return false;
12547}
@ SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA
Definition SharedDefines.h:568
@ UNIT_FLAG_PREPARATION
Definition UnitDefines.h:255
@ PLAYER_NO_REAGENT_COST_1
Definition UpdateFields.h:387

References Object::GetUInt32Value(), SpellInfo::HasAttribute(), Unit::HasUnitFlag(), PLAYER_NO_REAGENT_COST_1, SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA, SpellInfo::SpellFamilyFlags, and UNIT_FLAG_PREPARATION.

Referenced by Spell::CheckItems(), spell_dk_raise_dead::CheckReagents(), and Spell::TakeReagents().

◆ CanParry()

bool Player::CanParry ( ) const
inline

◆ CanPetResurrect()

bool Player::CanPetResurrect ( )
9192{
9193 PetStable* const petStable = GetPetStable();
9194 if (!petStable)
9195 {
9196 // No pets
9197 return false;
9198 }
9199
9200 auto const& currectPet = petStable->CurrentPet;
9201 auto const& unslottedHunterPet = petStable->GetUnslottedHunterPet();
9202
9203 if (!currectPet && !unslottedHunterPet)
9204 {
9205 // No pets
9206 return false;
9207 }
9208
9209 // Check current pet
9210 if (currectPet && !currectPet->Health)
9211 {
9212 return true;
9213 }
9214
9215 // Check dismiss/unslotted hunter pet
9216 if (unslottedHunterPet && !unslottedHunterPet->Health)
9217 {
9218 return true;
9219 }
9220
9221 return false;
9222}
Definition PetDefines.h:209
PetInfo const * GetUnslottedHunterPet() const
Definition PetDefines.h:237
Optional< PetInfo > CurrentPet
Definition PetDefines.h:232
PetStable * GetPetStable()
Definition Player.h:1224

References PetStable::CurrentPet, GetPetStable(), and PetStable::GetUnslottedHunterPet().

◆ CanReportAfkDueToLimit()

bool Player::CanReportAfkDueToLimit ( )
11347{
11348 // a player can complain about 15 people per 5 minutes
11349 if (m_bgData.bgAfkReportedCount++ >= 15)
11350 return false;
11351
11352 return true;
11353}
BGData m_bgData
Definition Player.h:2696
uint8 bgAfkReportedCount
Definition Player.h:1050

References BGData::bgAfkReportedCount, and m_bgData.

Referenced by ReportedAfkBy().

◆ CanRequestSpellCast()

bool Player::CanRequestSpellCast ( SpellInfo const *  spellInfo)
2340{
2341 if (!sWorld->getBoolConfig(CONFIG_SPELL_QUEUE_ENABLED))
2342 return false;
2343
2344 // Check for existing cast request with the same category
2345 if (GetCastRequest(spellInfo->GetCategory()))
2346 return false;
2347
2348 if (GetGlobalCooldownMgr().GetGlobalCooldown(spellInfo) > GetSpellQueueWindow())
2349 return false;
2350
2351 if (GetSpellCooldownDelay(spellInfo->Id) > GetSpellQueueWindow())
2352 return false;
2353
2354 // If there is an existing cast that will last longer than the allowable
2355 // spell queue window, then we can't request a new spell cast
2357 if (Spell* spell = GetCurrentSpell(spellSlot))
2358 if (spell->GetCastTimeRemaining() > static_cast<int32>(GetSpellQueueWindow()))
2359 return false;
2360
2361 return true;
2362}
@ CONFIG_SPELL_QUEUE_ENABLED
Definition WorldConfig.h:143
const PendingSpellCastRequest * GetCastRequest(uint32 category) const
Definition PlayerUpdates.cpp:2331

References CONFIG_SPELL_QUEUE_ENABLED, CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, GetCastRequest(), SpellInfo::GetCategory(), Unit::GetCurrentSpell(), GetGlobalCooldownMgr(), GetSpellCooldownDelay(), GetSpellQueueWindow(), SpellInfo::Id, and sWorld.

Referenced by WorldSession::HandleCastSpellOpcode(), and WorldSession::HandleUseItemOpcode().

◆ CanResummonPet()

bool Player::CanResummonPet ( uint32  spellid)
14224{
14226 {
14227 if (CanSeeDKPet())
14228 return true;
14229 else if (spellid == 52150) // Raise Dead
14230 return false;
14231 }
14232
14234 {
14235 if (HasSpell(31687) && HasAura(70937)) //Has [Summon Water Elemental] spell and [Glyph of Eternal Water].
14236 return true;
14237 }
14238
14240 {
14241 return true;
14242 }
14243
14244 return HasSpell(spellid);
14245}
@ CLASS_MAGE
Definition SharedDefines.h:148
@ CLASS_CONTEXT_PET
Definition UnitDefines.h:236
bool CanSeeDKPet() const
Definition Player.h:2612

References CanSeeDKPet(), CLASS_CONTEXT_PET, CLASS_DEATH_KNIGHT, CLASS_HUNTER, CLASS_MAGE, Unit::HasAura(), HasSpell(), and IsClass().

Referenced by spell_gen_pet_summoned::HandleScript(), and ResummonPetTemporaryUnSummonedIfAny().

◆ CanRewardQuest() [1/2]

bool Player::CanRewardQuest ( Quest const *  quest,
bool  msg 
)
386{
387 // not auto complete quest and not completed quest (only cheating case, then ignore without message)
388 if (!quest->IsDFQuest() && !quest->IsAutoComplete() && quest->GetQuestMethod() && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE)
389 return false;
390
391 // daily quest can't be rewarded (25 daily quest already completed)
392 if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestMonth(quest, true) || !SatisfyQuestSeasonal(quest, true))
393 return false;
394
395 // rewarded and not repeatable quest (only cheating case, then ignore without message)
396 if (GetQuestRewardStatus(quest->GetQuestId()))
397 return false;
398
399 // prevent receive reward with quest items in bank
400 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
401 {
402 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
403 {
404 if (quest->RequiredItemCount[i] != 0 &&
405 GetItemCount(quest->RequiredItemId[i]) < quest->RequiredItemCount[i])
406 {
407 if (msg)
408 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr, quest->RequiredItemId[i]);
409 return false;
410 }
411 }
412 }
413
414 // prevent receive reward with low money and GetRewOrReqMoney() < 0
415 if (quest->GetRewOrReqMoney() < 0 && !HasEnoughMoney(-quest->GetRewOrReqMoney()))
416 return false;
417
418 return true;
419}
bool SatisfyQuestDay(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1268
bool SatisfyQuestMonth(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1326
bool SatisfyQuestSeasonal(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1311
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition PlayerQuest.cpp:1430
bool SatisfyQuestWeek(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1302

References EQUIP_ERR_ITEM_NOT_FOUND, GetItemCount(), Quest::GetQuestId(), Quest::GetQuestMethod(), GetQuestRewardStatus(), GetQuestStatus(), Quest::GetRewOrReqMoney(), HasEnoughMoney(), Quest::HasSpecialFlag(), Quest::IsAutoComplete(), Quest::IsDFQuest(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_STATUS_COMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, SatisfyQuestDay(), SatisfyQuestMonth(), SatisfyQuestSeasonal(), SatisfyQuestWeek(), and SendEquipError().

Referenced by CanCompleteRepeatableQuest(), CanRewardQuest(), lfg::LFGMgr::FinishDungeon(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), npc_elder_clearwater::OnGossipHello(), and SendPreparedQuest().

◆ CanRewardQuest() [2/2]

bool Player::CanRewardQuest ( Quest const *  quest,
uint32  reward,
bool  msg 
)
469{
470 // prevent receive reward with quest items in bank or for not completed quest
471 if (!CanRewardQuest(quest, msg))
472 return false;
473
474 ItemPosCountVec dest;
475 if (quest->GetRewChoiceItemsCount() > 0)
476 {
477 if (quest->RewardChoiceItemId[reward])
478 {
479 InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardChoiceItemId[reward], quest->RewardChoiceItemCount[reward]);
480 if (res != EQUIP_ERR_OK)
481 {
482 SendEquipError(res, nullptr, nullptr, quest->RewardChoiceItemId[reward]);
483 return false;
484 }
485 }
486 }
487
488 if (quest->GetRewItemsCount() > 0)
489 {
490 for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
491 {
492 if (quest->RewardItemId[i])
493 {
494 InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardItemId[i], quest->RewardItemIdCount[i]);
495 if (res != EQUIP_ERR_OK)
496 {
497 SendEquipError(res, nullptr, nullptr, quest->RewardItemId[i]);
498 return false;
499 }
500 }
501 }
502 }
503
504 return true;
505}

References CanRewardQuest(), CanStoreNewItem(), EQUIP_ERR_OK, Quest::GetRewChoiceItemsCount(), Quest::GetRewItemsCount(), NULL_BAG, NULL_SLOT, Quest::RewardChoiceItemCount, Quest::RewardChoiceItemId, Quest::RewardItemId, Quest::RewardItemIdCount, and SendEquipError().

◆ CanRollForItemInLFG()

InventoryResult Player::CanRollForItemInLFG ( ItemTemplate const *  item,
WorldObject const *  lootedObject 
) const
2338{
2339 if (!GetGroup() || !GetGroup()->isLFGGroup(true))
2340 return EQUIP_ERR_OK; // not in LFG group
2341
2342 // check if looted object is inside the lfg dungeon
2343 Map const* map = lootedObject->GetMap();
2344 if (!sLFGMgr->inLfgDungeonMap(GetGroup()->GetGUID(), map->GetId(), map->GetDifficulty()))
2345 return EQUIP_ERR_OK;
2346
2347 if (!proto)
2349 // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
2350
2351 const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
2352 {
2358 }; //Copy from function Item::GetSkill()
2359
2360 if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
2362
2363 if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
2365
2366 if (proto->RequiredSkill != 0)
2367 {
2368 if (!GetSkillValue(proto->RequiredSkill))
2370 else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
2372 }
2373
2374 if (proto->Class == ITEM_CLASS_WEAPON && GetSkillValue(item_weapon_skills[proto->SubClass]) == 0)
2376
2377 if (proto->Class == ITEM_CLASS_ARMOR)
2378 {
2379 // Check for shields
2380 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_SHIELD && !(
2384 {
2386 }
2387
2388 // Check for librams.
2390 {
2392 }
2393
2394 // CHeck for idols.
2396 {
2398 }
2399
2400 // Check for totems.
2402 {
2404 }
2405
2406 // Check for sigils.
2408 {
2410 }
2411 }
2412
2413 if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass > ITEM_SUBCLASS_ARMOR_MISC && proto->SubClass < ITEM_SUBCLASS_ARMOR_BUCKLER &&
2414 proto->InventoryType != INVTYPE_CLOAK)
2415 {
2416 uint32 subclassToCompare = ITEM_SUBCLASS_ARMOR_CLOTH;
2418 {
2419 subclassToCompare = ITEM_SUBCLASS_ARMOR_PLATE;
2420 }
2422 {
2423 if ((proto->HasStat(ITEM_MOD_SPELL_POWER) || proto->HasSpellPowerStat()))
2424 {
2426 }
2427 subclassToCompare = ITEM_SUBCLASS_ARMOR_PLATE;
2428 }
2430 {
2431 subclassToCompare = ITEM_SUBCLASS_ARMOR_MAIL;
2432 }
2434 {
2435 subclassToCompare = ITEM_SUBCLASS_ARMOR_LEATHER;
2436 }
2438 {
2439 if (proto->HasStat(ITEM_MOD_SPELL_POWER) || proto->HasSpellPowerStat())
2440 {
2442 }
2443 subclassToCompare = ITEM_SUBCLASS_ARMOR_LEATHER;
2444 }
2445
2446 if (proto->SubClass > subclassToCompare)
2447 {
2449 }
2450 else if (sWorld->getIntConfig(CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION) && proto->ItemLevel > sWorld->getIntConfig(CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION))
2451 {
2452 if (proto->SubClass < subclassToCompare)
2453 {
2455 }
2456 }
2457 }
2458
2459 return EQUIP_ERR_OK;
2460}
@ INVTYPE_CLOAK
Definition ItemTemplate.h:272
@ ITEM_SUBCLASS_ARMOR_BUCKLER
Definition ItemTemplate.h:395
@ ITEM_SUBCLASS_ARMOR_LIBRAM
Definition ItemTemplate.h:397
@ ITEM_SUBCLASS_ARMOR_MISC
Definition ItemTemplate.h:390
@ ITEM_SUBCLASS_ARMOR_SIGIL
Definition ItemTemplate.h:400
@ ITEM_SUBCLASS_ARMOR_TOTEM
Definition ItemTemplate.h:399
@ ITEM_SUBCLASS_ARMOR_IDOL
Definition ItemTemplate.h:398
#define MAX_ITEM_SUBCLASS_WEAPON
Definition ItemTemplate.h:371
@ EQUIP_ERR_CANT_EQUIP_SKILL
Definition Item.h:49
@ EQUIP_ERR_NO_REQUIRED_PROFICIENCY
Definition Item.h:55
@ EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM
Definition Item.h:57
#define sLFGMgr
Definition LFGMgr.h:641
@ CLASS_WARRIOR
Definition SharedDefines.h:141
@ CLASS_ROGUE
Definition SharedDefines.h:144
@ SKILL_BOWS
Definition SharedDefines.h:3112
@ SKILL_MACES
Definition SharedDefines.h:3116
@ SKILL_WANDS
Definition SharedDefines.h:3180
@ SKILL_GUNS
Definition SharedDefines.h:3113
@ SKILL_CROSSBOWS
Definition SharedDefines.h:3179
@ SKILL_THROWN
Definition SharedDefines.h:3153
@ SKILL_FISHING
Definition SharedDefines.h:3196
@ SKILL_SWORDS
Definition SharedDefines.h:3110
@ SKILL_DAGGERS
Definition SharedDefines.h:3152
@ SKILL_2H_AXES
Definition SharedDefines.h:3151
@ SKILL_POLEARMS
Definition SharedDefines.h:3181
@ SKILL_2H_SWORDS
Definition SharedDefines.h:3117
@ SKILL_FIST_WEAPONS
Definition SharedDefines.h:3205
@ SKILL_2H_MACES
Definition SharedDefines.h:3145
@ SKILL_AXES
Definition SharedDefines.h:3111
@ SKILL_STAVES
Definition SharedDefines.h:3133
@ SKILL_ASSASSINATION
Definition SharedDefines.h:3185
@ CLASS_CONTEXT_EQUIP_SHIELDS
Definition UnitDefines.h:239
@ CLASS_CONTEXT_EQUIP_RELIC
Definition UnitDefines.h:238
@ CLASS_CONTEXT_EQUIP_ARMOR_CLASS
Definition UnitDefines.h:240
@ CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION
Definition WorldConfig.h:371
uint32 GetId() const
Definition Map.h:224
Difficulty GetDifficulty() const
Definition Map.h:285
uint32 getRaceMask() const
Definition Unit.h:788

References ItemTemplate::AllowableClass, ItemTemplate::AllowableRace, ItemTemplate::Class, CLASS_CONTEXT_EQUIP_ARMOR_CLASS, CLASS_CONTEXT_EQUIP_RELIC, CLASS_CONTEXT_EQUIP_SHIELDS, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_PALADIN, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARRIOR, CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_EQUIP_SKILL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM, Unit::getClassMask(), Map::GetDifficulty(), GetGroup(), Object::GetGUID(), Map::GetId(), WorldObject::GetMap(), Unit::getRaceMask(), GetSkillValue(), HasSpell(), ItemTemplate::HasSpellPowerStat(), ItemTemplate::HasStat(), ItemTemplate::InventoryType, INVTYPE_CLOAK, IsClass(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, ITEM_MOD_SPELL_POWER, ITEM_SUBCLASS_ARMOR_BUCKLER, ITEM_SUBCLASS_ARMOR_CLOTH, ITEM_SUBCLASS_ARMOR_IDOL, ITEM_SUBCLASS_ARMOR_LEATHER, ITEM_SUBCLASS_ARMOR_LIBRAM, ITEM_SUBCLASS_ARMOR_MAIL, ITEM_SUBCLASS_ARMOR_MISC, ITEM_SUBCLASS_ARMOR_PLATE, ITEM_SUBCLASS_ARMOR_SHIELD, ITEM_SUBCLASS_ARMOR_SIGIL, ITEM_SUBCLASS_ARMOR_TOTEM, ItemTemplate::ItemLevel, MAX_ITEM_SUBCLASS_WEAPON, ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, ItemTemplate::RequiredSpell, SKILL_2H_AXES, SKILL_2H_MACES, SKILL_2H_SWORDS, SKILL_ASSASSINATION, SKILL_AXES, SKILL_BOWS, SKILL_CROSSBOWS, SKILL_DAGGERS, SKILL_FISHING, SKILL_FIST_WEAPONS, SKILL_GUNS, SKILL_MACES, SKILL_POLEARMS, SKILL_STAVES, SKILL_SWORDS, SKILL_THROWN, SKILL_WANDS, sLFGMgr, ItemTemplate::SubClass, and sWorld.

Referenced by Group::NeedBeforeGreed().

◆ CanSeeDKPet()

bool Player::CanSeeDKPet ( ) const
inline

◆ CanSeeSpellClickOn()

bool Player::CanSeeSpellClickOn ( Creature const *  creature) const
14248{
14249 if (!c->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
14250 return false;
14251
14252 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(c->GetEntry());
14253 if (clickPair.first == clickPair.second)
14254 return true;
14255
14256 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
14257 {
14258 if (!itr->second.IsFitToRequirements(this, c))
14259 return false;
14260
14261 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
14262 ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
14263 if (sConditionMgr->IsObjectMeetToConditions(info, conds))
14264 return true;
14265 }
14266
14267 return false;
14268}
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition ObjectMgr.h:408
@ UNIT_NPC_FLAG_SPELLCLICK
Definition UnitDefines.h:339
Definition ConditionMgr.h:182

References Object::GetEntry(), Unit::HasNpcFlag(), sConditionMgr, sObjectMgr, and UNIT_NPC_FLAG_SPELLCLICK.

Referenced by Unit::PatchValuesUpdate().

◆ CanSeeStartQuest()

bool Player::CanSeeStartQuest ( Quest const *  quest)
238{
239 if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) &&
240 SatisfyQuestSkill(quest, false) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
241 SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
242 SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
243 SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
244 {
245 return GetLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
246 }
247
248 return false;
249}
#define sDisableMgr
Definition DisableMgr.h:88
@ DISABLE_TYPE_QUEST
Definition DisableMgr.h:29
@ CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF
Definition WorldConfig.h:237
bool SatisfyQuestNextChain(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1220
bool SatisfyQuestExclusiveGroup(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1183
bool SatisfyQuestRace(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1103
bool SatisfyQuestClass(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1085
bool SatisfyQuestReputation(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1117
bool SatisfyQuestPreviousQuest(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:999
bool SatisfyQuestSkill(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:947
bool SatisfyQuestPrevChain(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1240

References CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, DISABLE_TYPE_QUEST, Unit::GetLevel(), Quest::GetMinLevel(), Quest::GetQuestId(), SatisfyQuestClass(), SatisfyQuestDay(), SatisfyQuestExclusiveGroup(), SatisfyQuestMonth(), SatisfyQuestNextChain(), SatisfyQuestPrevChain(), SatisfyQuestPreviousQuest(), SatisfyQuestRace(), SatisfyQuestReputation(), SatisfyQuestSeasonal(), SatisfyQuestSkill(), SatisfyQuestWeek(), sDisableMgr, and sWorld.

Referenced by npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), WorldSession::HandleQuestgiverChooseRewardOpcode(), and WorldSession::HandleQuestgiverCompleteQuest().

◆ CanSeeVendor()

bool Player::CanSeeVendor ( Creature const *  creature) const
14271{
14272 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_VENDOR))
14273 return true;
14274
14275 ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), 0);
14276 if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(this), const_cast<Creature*>(creature), conditions))
14277 {
14278 return false;
14279 }
14280
14281 return true;
14282}

References Object::GetEntry(), Unit::HasNpcFlag(), sConditionMgr, and UNIT_NPC_FLAG_VENDOR.

Referenced by Unit::PatchValuesUpdate().

◆ CanShareQuest()

bool Player::CanShareQuest ( uint32  quest_id) const
1459{
1460 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
1461 if (qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE))
1462 {
1463 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
1464 if (itr != m_QuestStatus.end())
1465 {
1466 // in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share
1467 if (sPoolMgr->IsPartOfAPool<Quest>(quest_id) && !sPoolMgr->IsSpawnedObject<Quest>(quest_id))
1468 {
1470 return false;
1471 }
1472
1473 return true;
1474 }
1475 }
1476 return false;
1477}
#define sPoolMgr
Definition PoolMgr.h:163
@ QUEST_FLAGS_SHARABLE
Definition QuestDef.h:135
@ QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY
Definition QuestDef.h:74
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition PlayerQuest.cpp:2435
bool HasFlag(uint32 flag) const
Definition QuestDef.h:221

References Quest::HasFlag(), m_QuestStatus, QUEST_FLAGS_SHARABLE, QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY, SendPushToPartyResponse(), sObjectMgr, and sPoolMgr.

Referenced by WorldSession::HandlePushQuestToParty(), and WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ CanSpeak()

bool Player::CanSpeak ( ) const
70{
71 return GetSession()->m_muteTime <= time (nullptr);
72}
time_t m_muteTime
Definition WorldSession.h:513

References GetSession(), and WorldSession::m_muteTime.

Referenced by WorldSession::HandleMessagechatOpcode(), and misc_commandscript::HandleUnmuteCommand().

◆ CanStoreItem() [1/2]

◆ CanStoreItem() [2/2]

InventoryResult Player::CanStoreItem ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
uint32  entry,
uint32  count,
Item pItem = nullptr,
bool  swap = false,
uint32 no_space_count = nullptr 
) const
1102{
1103 LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItem bag = {}, slot = {}, item = {}, count = {}", bag, slot, entry, count);
1104
1105 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry);
1106 if (!pProto)
1107 {
1108 if (no_space_count)
1109 *no_space_count = count;
1111 }
1112
1113 if (pItem)
1114 {
1115 // you bad chet0rz, wpe pro
1116 if (bag == NULL_BAG && slot == NULL_SLOT)
1117 if (pItem->IsBag() && pItem->IsNotEmptyBag())
1119
1120 // Xinef: Removed next loot generated check
1121 if (pItem->GetGUID() == GetLootGUID())
1122 {
1123 if (no_space_count)
1124 *no_space_count = count;
1126 }
1127
1128 if (pItem->IsBindedNotWith(this))
1129 {
1130 if (no_space_count)
1131 *no_space_count = count;
1133 }
1134 }
1135
1136 // check count of items (skip for auto move for same player from bank)
1137 uint32 no_similar_count = 0; // can't store this amount similar items
1138 InventoryResult res = CanTakeMoreSimilarItems(entry, count, pItem, &no_similar_count);
1139 if (res != EQUIP_ERR_OK)
1140 {
1141 if (count == no_similar_count)
1142 {
1143 if (no_space_count)
1144 *no_space_count = no_similar_count;
1145 return res;
1146 }
1147 count -= no_similar_count;
1148 }
1149
1150 // in specific slot
1151 if (bag != NULL_BAG && slot != NULL_SLOT)
1152 {
1153 res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
1154 if (res != EQUIP_ERR_OK)
1155 {
1156 if (no_space_count)
1157 *no_space_count = count + no_similar_count;
1158 return res;
1159 }
1160
1161 if (count == 0)
1162 {
1163 if (no_similar_count == 0)
1164 return EQUIP_ERR_OK;
1165
1166 if (no_space_count)
1167 *no_space_count = count + no_similar_count;
1169 }
1170 }
1171
1172 // not specific slot or have space for partly store only in specific slot
1173
1174 // in specific bag
1175 if (bag != NULL_BAG)
1176 {
1177 // search stack in bag for merge to
1178 if (pProto->Stackable != 1)
1179 {
1180 if (bag == INVENTORY_SLOT_BAG_0) // inventory
1181 {
1182 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
1183 if (res != EQUIP_ERR_OK)
1184 {
1185 if (no_space_count)
1186 *no_space_count = count + no_similar_count;
1187 return res;
1188 }
1189
1190 if (count == 0)
1191 {
1192 if (no_similar_count == 0)
1193 return EQUIP_ERR_OK;
1194
1195 if (no_space_count)
1196 *no_space_count = count + no_similar_count;
1198 }
1199
1200 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
1201 if (res != EQUIP_ERR_OK)
1202 {
1203 if (no_space_count)
1204 *no_space_count = count + no_similar_count;
1205 return res;
1206 }
1207
1208 if (count == 0)
1209 {
1210 if (no_similar_count == 0)
1211 return EQUIP_ERR_OK;
1212
1213 if (no_space_count)
1214 *no_space_count = count + no_similar_count;
1216 }
1217 }
1218 else // equipped bag
1219 {
1220 // we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag
1221 res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
1222 if (res != EQUIP_ERR_OK)
1223 res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
1224
1225 if (res != EQUIP_ERR_OK)
1226 {
1227 if (no_space_count)
1228 *no_space_count = count + no_similar_count;
1229 return res;
1230 }
1231
1232 if (count == 0)
1233 {
1234 if (no_similar_count == 0)
1235 return EQUIP_ERR_OK;
1236
1237 if (no_space_count)
1238 *no_space_count = count + no_similar_count;
1240 }
1241 }
1242 }
1243
1244 // search free slot in bag for place to
1245 if (bag == INVENTORY_SLOT_BAG_0) // inventory
1246 {
1247 // search free slot - keyring case
1248 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1249 {
1250 uint32 keyringSize = GetMaxKeyringSize();
1251 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START + keyringSize, dest, pProto, count, false, pItem, bag, slot);
1252 if (res != EQUIP_ERR_OK)
1253 {
1254 if (no_space_count)
1255 *no_space_count = count + no_similar_count;
1256 return res;
1257 }
1258
1259 if (count == 0)
1260 {
1261 if (no_similar_count == 0)
1262 return EQUIP_ERR_OK;
1263
1264 if (no_space_count)
1265 *no_space_count = count + no_similar_count;
1267 }
1268
1269 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1270 if (res != EQUIP_ERR_OK)
1271 {
1272 if (no_space_count)
1273 *no_space_count = count + no_similar_count;
1274 return res;
1275 }
1276
1277 if (count == 0)
1278 {
1279 if (no_similar_count == 0)
1280 return EQUIP_ERR_OK;
1281
1282 if (no_space_count)
1283 *no_space_count = count + no_similar_count;
1285 }
1286 }
1287 else if (pProto->IsCurrencyToken())
1288 {
1289 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1290 if (res != EQUIP_ERR_OK)
1291 {
1292 if (no_space_count)
1293 *no_space_count = count + no_similar_count;
1294 return res;
1295 }
1296
1297 if (count == 0)
1298 {
1299 if (no_similar_count == 0)
1300 return EQUIP_ERR_OK;
1301
1302 if (no_space_count)
1303 *no_space_count = count + no_similar_count;
1305 }
1306 }
1307
1308 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
1309 if (res != EQUIP_ERR_OK)
1310 {
1311 if (no_space_count)
1312 *no_space_count = count + no_similar_count;
1313 return res;
1314 }
1315
1316 if (count == 0)
1317 {
1318 if (no_similar_count == 0)
1319 return EQUIP_ERR_OK;
1320
1321 if (no_space_count)
1322 *no_space_count = count + no_similar_count;
1324 }
1325 }
1326 else // equipped bag
1327 {
1328 res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
1329 if (res != EQUIP_ERR_OK)
1330 res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
1331
1332 if (res != EQUIP_ERR_OK)
1333 {
1334 if (no_space_count)
1335 *no_space_count = count + no_similar_count;
1336 return res;
1337 }
1338
1339 if (count == 0)
1340 {
1341 if (no_similar_count == 0)
1342 return EQUIP_ERR_OK;
1343
1344 if (no_space_count)
1345 *no_space_count = count + no_similar_count;
1347 }
1348 }
1349 }
1350
1351 // not specific bag or have space for partly store only in specific bag
1352
1353 // search stack for merge to
1354 if (pProto->Stackable != 1)
1355 {
1356 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
1357 if (res != EQUIP_ERR_OK)
1358 {
1359 if (no_space_count)
1360 *no_space_count = count + no_similar_count;
1361 return res;
1362 }
1363
1364 if (count == 0)
1365 {
1366 if (no_similar_count == 0)
1367 return EQUIP_ERR_OK;
1368
1369 if (no_space_count)
1370 *no_space_count = count + no_similar_count;
1372 }
1373
1374 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
1375 if (res != EQUIP_ERR_OK)
1376 {
1377 if (no_space_count)
1378 *no_space_count = count + no_similar_count;
1379 return res;
1380 }
1381
1382 if (count == 0)
1383 {
1384 if (no_similar_count == 0)
1385 return EQUIP_ERR_OK;
1386
1387 if (no_space_count)
1388 *no_space_count = count + no_similar_count;
1390 }
1391
1392 if (pProto->BagFamily)
1393 {
1395 {
1396 res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
1397 if (res != EQUIP_ERR_OK)
1398 continue;
1399
1400 if (count == 0)
1401 {
1402 if (no_similar_count == 0)
1403 return EQUIP_ERR_OK;
1404
1405 if (no_space_count)
1406 *no_space_count = count + no_similar_count;
1408 }
1409 }
1410 }
1411
1413 {
1414 res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
1415 if (res != EQUIP_ERR_OK)
1416 continue;
1417
1418 if (count == 0)
1419 {
1420 if (no_similar_count == 0)
1421 return EQUIP_ERR_OK;
1422
1423 if (no_space_count)
1424 *no_space_count = count + no_similar_count;
1426 }
1427 }
1428 }
1429
1430 // search free slot - special bag case
1431 if (pProto->BagFamily)
1432 {
1433 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1434 {
1435 uint32 keyringSize = GetMaxKeyringSize();
1436 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START + keyringSize, dest, pProto, count, false, pItem, bag, slot);
1437 if (res != EQUIP_ERR_OK)
1438 {
1439 if (no_space_count)
1440 *no_space_count = count + no_similar_count;
1441 return res;
1442 }
1443
1444 if (count == 0)
1445 {
1446 if (no_similar_count == 0)
1447 return EQUIP_ERR_OK;
1448
1449 if (no_space_count)
1450 *no_space_count = count + no_similar_count;
1452 }
1453 }
1454 else if (pProto->IsCurrencyToken())
1455 {
1456 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1457 if (res != EQUIP_ERR_OK)
1458 {
1459 if (no_space_count)
1460 *no_space_count = count + no_similar_count;
1461 return res;
1462 }
1463
1464 if (count == 0)
1465 {
1466 if (no_similar_count == 0)
1467 return EQUIP_ERR_OK;
1468
1469 if (no_space_count)
1470 *no_space_count = count + no_similar_count;
1472 }
1473 }
1474
1476 {
1477 res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
1478 if (res != EQUIP_ERR_OK)
1479 continue;
1480
1481 if (count == 0)
1482 {
1483 if (no_similar_count == 0)
1484 return EQUIP_ERR_OK;
1485
1486 if (no_space_count)
1487 *no_space_count = count + no_similar_count;
1489 }
1490 }
1491 }
1492
1493 if (pItem && pItem->IsNotEmptyBag())
1495
1496 // search free slot
1497 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
1498 if (res != EQUIP_ERR_OK)
1499 {
1500 if (no_space_count)
1501 *no_space_count = count + no_similar_count;
1502 return res;
1503 }
1504
1505 if (count == 0)
1506 {
1507 if (no_similar_count == 0)
1508 return EQUIP_ERR_OK;
1509
1510 if (no_space_count)
1511 *no_space_count = count + no_similar_count;
1513 }
1514
1516 {
1517 res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
1518 if (res != EQUIP_ERR_OK)
1519 continue;
1520
1521 if (count == 0)
1522 {
1523 if (no_similar_count == 0)
1524 return EQUIP_ERR_OK;
1525
1526 if (no_space_count)
1527 *no_space_count = count + no_similar_count;
1529 }
1530 }
1531
1532 if (no_space_count)
1533 *no_space_count = count + no_similar_count;
1534
1536}
@ BAG_FAMILY_MASK_KEYS
Definition ItemTemplate.h:235
@ EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS
Definition Item.h:78
@ INVENTORY_SLOT_ITEM_START
Definition Player.h:712
@ INVENTORY_SLOT_ITEM_END
Definition Player.h:713
uint32 GetMaxKeyringSize() const
Definition Player.h:1370
bool IsCurrencyToken() const
Definition ItemTemplate.h:726

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanTakeMoreSimilarItems(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, Object::GetGUID(), GetLootGUID(), GetMaxKeyringSize(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Item::IsBag(), Item::IsBindedNotWith(), ItemTemplate::IsCurrencyToken(), Item::IsNotEmptyBag(), KEYRING_SLOT_START, LOG_DEBUG, NULL_BAG, NULL_SLOT, sObjectMgr, and ItemTemplate::Stackable.

◆ CanStoreItem_InBag()

InventoryResult Player::CanStoreItem_InBag ( uint8  bag,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  merge,
bool  non_specialized,
Item pSrcItem,
uint8  skip_bag,
uint8  skip_slot 
) const
private
981{
982 // skip specific bag already processed in first called CanStoreItem_InBag
983 if (bag == skip_bag)
985
986 // skip not existed bag or self targeted bag
987 Bag* pBag = GetBagByPos(bag);
988 if (!pBag || pBag == pSrcItem || (pSrcItem && (pSrcItem->GetGUID() == pBag->GetGUID())))
990
991 if (pSrcItem && pSrcItem->IsNotEmptyBag())
993
994 ItemTemplate const* pBagProto = pBag->GetTemplate();
995 if (!pBagProto)
997
998 // specialized bag mode or non-specilized
999 if (non_specialized != (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER))
1001
1002 if (!ItemCanGoIntoBag(pProto, pBagProto))
1004
1005 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
1006 {
1007 // skip specific slot already processed in first called CanStoreItem_InSpecificSlot
1008 if (j == skip_slot)
1009 continue;
1010
1011 Item* pItem2 = GetItemByPos(bag, j);
1012
1013 // ignore move item (this slot will be empty at move)
1014 if (pItem2 == pSrcItem)
1015 pItem2 = nullptr;
1016
1017 // if merge skip empty, if !merge skip non-empty
1018 if ((pItem2 != nullptr) != merge)
1019 continue;
1020
1021 uint32 need_space = pProto->GetMaxStackSize();
1022
1023 if (pItem2)
1024 {
1025 // can be merged at least partly
1026 uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
1027 if (res != EQUIP_ERR_OK)
1028 continue;
1029
1030 // descrease at current stacksize
1031 need_space -= pItem2->GetCount();
1032 }
1033
1034 if (need_space > count)
1035 need_space = count;
1036
1037 ItemPosCount newPosition = ItemPosCount((bag << 8) | j, need_space);
1038 if (!newPosition.isContainedIn(dest))
1039 {
1040 dest.push_back(newPosition);
1041 count -= need_space;
1042
1043 if (count == 0)
1044 return EQUIP_ERR_OK;
1045 }
1046 }
1047 return EQUIP_ERR_OK;
1048}
@ ITEM_SUBCLASS_CONTAINER
Definition ItemTemplate.h:329
@ ITEM_CLASS_CONTAINER
Definition ItemTemplate.h:292
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
Definition Item.cpp:176
@ EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG
Definition Item.h:62
uint32 GetBagSize() const
Definition Bag.h:48
InventoryResult CanBeMergedPartlyWith(ItemTemplate const *proto) const
Definition Item.cpp:867
Definition Player.h:772
bool isContainedIn(std::vector< ItemPosCount > const &vec) const
Definition Player.cpp:13114

References Item::CanBeMergedPartlyWith(), ItemTemplate::Class, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG, EQUIP_ERR_OK, GetBagByPos(), Bag::GetBagSize(), Item::GetCount(), Object::GetGUID(), GetItemByPos(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), ItemPosCount::isContainedIn(), Item::IsNotEmptyBag(), ITEM_CLASS_CONTAINER, ITEM_SUBCLASS_CONTAINER, ItemCanGoIntoBag(), and ItemTemplate::SubClass.

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItem_InInventorySlots()

InventoryResult Player::CanStoreItem_InInventorySlots ( uint8  slot_begin,
uint8  slot_end,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  merge,
Item pSrcItem,
uint8  skip_bag,
uint8  skip_slot 
) const
private
1051{
1052 //this is never called for non-bag slots so we can do this
1053 if (pSrcItem && pSrcItem->IsNotEmptyBag())
1055
1056 for (uint32 j = slot_begin; j < slot_end; j++)
1057 {
1058 // skip specific slot already processed in first called CanStoreItem_InSpecificSlot
1059 if (INVENTORY_SLOT_BAG_0 == skip_bag && j == skip_slot)
1060 continue;
1061
1063
1064 // ignore move item (this slot will be empty at move)
1065 if (pItem2 == pSrcItem)
1066 pItem2 = nullptr;
1067
1068 // if merge skip empty, if !merge skip non-empty
1069 if ((pItem2 != nullptr) != merge)
1070 continue;
1071
1072 uint32 need_space = pProto->GetMaxStackSize();
1073
1074 if (pItem2)
1075 {
1076 // can be merged at least partly
1077 uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
1078 if (res != EQUIP_ERR_OK)
1079 continue;
1080
1081 // descrease at current stacksize
1082 need_space -= pItem2->GetCount();
1083 }
1084
1085 if (need_space > count)
1086 need_space = count;
1087
1088 ItemPosCount newPosition = ItemPosCount((INVENTORY_SLOT_BAG_0 << 8) | j, need_space);
1089 if (!newPosition.isContainedIn(dest))
1090 {
1091 dest.push_back(newPosition);
1092 count -= need_space;
1093
1094 if (count == 0)
1095 return EQUIP_ERR_OK;
1096 }
1097 }
1098 return EQUIP_ERR_OK;
1099}

References Item::CanBeMergedPartlyWith(), EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_OK, Item::GetCount(), GetItemByPos(), ItemTemplate::GetMaxStackSize(), INVENTORY_SLOT_BAG_0, ItemPosCount::isContainedIn(), and Item::IsNotEmptyBag().

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItem_InSpecificSlot()

InventoryResult Player::CanStoreItem_InSpecificSlot ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  swap,
Item pSrcItem 
) const
private
910{
911 Item* pItem2 = GetItemByPos(bag, slot);
912
913 // ignore move item (this slot will be empty at move)
914 if (pItem2 == pSrcItem)
915 pItem2 = nullptr;
916
917 uint32 need_space;
918
919 // empty specific slot - check item fit to slot
920 if (!pItem2 || swap)
921 {
922 if (bag == INVENTORY_SLOT_BAG_0)
923 {
924 // keyring case
925 if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START + GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS))
927
928 // currencytoken case
929 if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->IsCurrencyToken()))
931
932 // prevent cheating
933 if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END)
935 }
936 else
937 {
938 Bag* pBag = GetBagByPos(bag);
939 if (!pBag)
941
942 ItemTemplate const* pBagProto = pBag->GetTemplate();
943 if (!pBagProto)
945
946 if (slot >= pBagProto->ContainerSlots)
948
949 if (!ItemCanGoIntoBag(pProto, pBagProto))
951 }
952
953 // non empty stack with space
954 need_space = pProto->GetMaxStackSize();
955 }
956 // non empty slot, check item type
957 else
958 {
959 // can be merged at least partly
960 InventoryResult res = pItem2->CanBeMergedPartlyWith(pProto);
961 if (res != EQUIP_ERR_OK)
962 return res;
963
964 // free stack space or infinity
965 need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
966 }
967
968 if (need_space > count)
969 need_space = count;
970
971 ItemPosCount newPosition = ItemPosCount((bag << 8) | slot, need_space);
972 if (!newPosition.isContainedIn(dest))
973 {
974 dest.push_back(newPosition);
975 count -= need_space;
976 }
977 return EQUIP_ERR_OK;
978}
uint32 ContainerSlots
Definition ItemTemplate.h:646

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, BUYBACK_SLOT_END, BUYBACK_SLOT_START, Item::CanBeMergedPartlyWith(), ItemTemplate::ContainerSlots, CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG, EQUIP_ERR_OK, GetBagByPos(), Item::GetCount(), GetItemByPos(), GetMaxKeyringSize(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemPosCount::isContainedIn(), ItemTemplate::IsCurrencyToken(), ItemCanGoIntoBag(), KEYRING_SLOT_START, and PLAYER_SLOT_END.

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItems()

InventoryResult Player::CanStoreItems ( Item **  pItem,
int32  count 
) const
1540{
1541 Item* pItem2;
1542
1543 // fill space table
1546 int inv_keys[KEYRING_SLOT_END - KEYRING_SLOT_START];
1548
1549 memset(inv_slot_items, 0, sizeof(int) * (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START));
1550 memset(inv_bags, 0, sizeof(int) * (INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START) * MAX_BAG_SIZE);
1551 memset(inv_keys, 0, sizeof(int) * (KEYRING_SLOT_END - KEYRING_SLOT_START));
1552 memset(inv_tokens, 0, sizeof(int) * (CURRENCYTOKEN_SLOT_END - CURRENCYTOKEN_SLOT_START));
1553
1555 {
1557 if (pItem2 && !pItem2->IsInTrade())
1558 inv_slot_items[i - INVENTORY_SLOT_ITEM_START] = pItem2->GetCount();
1559 }
1560
1561 for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
1562 {
1564 if (pItem2 && !pItem2->IsInTrade())
1565 inv_keys[i - KEYRING_SLOT_START] = pItem2->GetCount();
1566 }
1567
1569 {
1571 if (pItem2 && !pItem2->IsInTrade())
1572 inv_tokens[i - CURRENCYTOKEN_SLOT_START] = pItem2->GetCount();
1573 }
1574
1576 if (Bag* pBag = GetBagByPos(i))
1577 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
1578 {
1579 pItem2 = GetItemByPos(i, j);
1580 if (pItem2 && !pItem2->IsInTrade())
1581 inv_bags[i - INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount();
1582 }
1583
1584 // check free space for all items
1585 for (int k = 0; k < count; ++k)
1586 {
1587 Item* pItem = pItems[k];
1588
1589 // no item
1590 if (!pItem)
1591 continue;
1592
1593 LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems {}. item = {}, count = {}", k + 1, pItem->GetEntry(), pItem->GetCount());
1594 ItemTemplate const* pProto = pItem->GetTemplate();
1595
1596 // strange item
1597 if (!pProto)
1599
1600 // Xinef: Removed next loot generated check
1601 if (pItem->GetGUID() == GetLootGUID())
1603
1604 // item it 'bind'
1605 if (pItem->IsBindedNotWith(this))
1607
1608 ItemTemplate const* pBagProto;
1609
1610 // item is 'one item only'
1612 if (res != EQUIP_ERR_OK)
1613 return res;
1614
1615 // search stack for merge to
1616 if (pProto->Stackable != 1)
1617 {
1618 bool b_found = false;
1619
1620 for (uint8 t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t)
1621 {
1623 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_keys[t - KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1624 {
1625 inv_keys[t - KEYRING_SLOT_START] += pItem->GetCount();
1626 b_found = true;
1627 break;
1628 }
1629 }
1630 if (b_found)
1631 continue;
1632
1633 for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
1634 {
1636 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_tokens[t - CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1637 {
1638 inv_tokens[t - CURRENCYTOKEN_SLOT_START] += pItem->GetCount();
1639 b_found = true;
1640 break;
1641 }
1642 }
1643 if (b_found)
1644 continue;
1645
1647 {
1649 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_slot_items[t - INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1650 {
1651 inv_slot_items[t - INVENTORY_SLOT_ITEM_START] += pItem->GetCount();
1652 b_found = true;
1653 break;
1654 }
1655 }
1656 if (b_found)
1657 continue;
1658
1659 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1660 {
1661 if (Bag* bag = GetBagByPos(t))
1662 {
1663 if (ItemCanGoIntoBag(pItem->GetTemplate(), bag->GetTemplate()))
1664 {
1665 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1666 {
1667 pItem2 = GetItemByPos(t, j);
1668 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_bags[t - INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
1669 {
1670 inv_bags[t - INVENTORY_SLOT_BAG_START][j] += pItem->GetCount();
1671 b_found = true;
1672 break;
1673 }
1674 }
1675 }
1676 }
1677 }
1678 if (b_found)
1679 continue;
1680 }
1681
1682 // special bag case
1683 if (pProto->BagFamily)
1684 {
1685 bool b_found = false;
1686 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1687 {
1688 uint32 keyringSize = GetMaxKeyringSize();
1689 for (uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START + keyringSize; ++t)
1690 {
1691 if (inv_keys[t - KEYRING_SLOT_START] == 0)
1692 {
1693 inv_keys[t - KEYRING_SLOT_START] = 1;
1694 b_found = true;
1695 break;
1696 }
1697 }
1698 }
1699
1700 if (b_found)
1701 continue;
1702
1703 if (pProto->IsCurrencyToken())
1704 {
1706 {
1707 if (inv_tokens[t - CURRENCYTOKEN_SLOT_START] == 0)
1708 {
1709 inv_tokens[t - CURRENCYTOKEN_SLOT_START] = 1;
1710 b_found = true;
1711 break;
1712 }
1713 }
1714 }
1715
1716 if (b_found)
1717 continue;
1718
1719 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1720 {
1721 if (Bag* bag = GetBagByPos(t))
1722 {
1723 pBagProto = bag->GetTemplate();
1724
1725 // not plain container check
1726 if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
1727 ItemCanGoIntoBag(pProto, pBagProto))
1728 {
1729 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1730 {
1731 if (inv_bags[t - INVENTORY_SLOT_BAG_START][j] == 0)
1732 {
1733 inv_bags[t - INVENTORY_SLOT_BAG_START][j] = 1;
1734 b_found = true;
1735 break;
1736 }
1737 }
1738 }
1739 }
1740 }
1741 if (b_found)
1742 continue;
1743 }
1744
1745 // search free slot
1746 bool b_found = false;
1748 {
1749 if (inv_slot_items[t - INVENTORY_SLOT_ITEM_START] == 0)
1750 {
1751 inv_slot_items[t - INVENTORY_SLOT_ITEM_START] = 1;
1752 b_found = true;
1753 break;
1754 }
1755 }
1756 if (b_found)
1757 continue;
1758
1759 // search free slot in bags
1760 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1761 {
1762 if (Bag* bag = GetBagByPos(t))
1763 {
1764 pBagProto = bag->GetTemplate();
1765
1766 // special bag already checked
1767 if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
1768 continue;
1769
1770 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1771 {
1772 if (inv_bags[t - INVENTORY_SLOT_BAG_START][j] == 0)
1773 {
1774 inv_bags[t - INVENTORY_SLOT_BAG_START][j] = 1;
1775 b_found = true;
1776 break;
1777 }
1778 }
1779 }
1780 }
1781
1782 // no free slot found?
1783 if (!b_found)
1785 }
1786
1787 return EQUIP_ERR_OK;
1788}
@ KEYRING_SLOT_END
Definition Player.h:738
bool IsInTrade() const
Definition Item.h:260

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, Item::CanBeMergedPartlyWith(), CanTakeMoreSimilarItems(), ItemTemplate::Class, CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, GetBagByPos(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), GetLootGUID(), GetMaxKeyringSize(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Item::IsBindedNotWith(), ItemTemplate::IsCurrencyToken(), Item::IsInTrade(), ITEM_CLASS_CONTAINER, ITEM_SUBCLASS_CONTAINER, ItemCanGoIntoBag(), KEYRING_SLOT_END, KEYRING_SLOT_START, LOG_DEBUG, MAX_BAG_SIZE, ItemTemplate::Stackable, and ItemTemplate::SubClass.

Referenced by WorldSession::HandleAcceptTradeOpcode().

◆ CanStoreNewItem()

◆ CanTakeMoreSimilarItems() [1/3]

InventoryResult Player::CanTakeMoreSimilarItems ( Item pItem) const
inline

◆ CanTakeMoreSimilarItems() [2/3]

InventoryResult Player::CanTakeMoreSimilarItems ( uint32  entry,
uint32  count 
) const
inline
1295{ return CanTakeMoreSimilarItems(entry, count, nullptr); }

References CanTakeMoreSimilarItems().

Referenced by CanTakeMoreSimilarItems().

◆ CanTakeMoreSimilarItems() [3/3]

InventoryResult Player::CanTakeMoreSimilarItems ( uint32  entry,
uint32  count,
Item pItem,
uint32 no_space_count = nullptr 
) const
801{
802 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry);
803 if (!pProto)
804 {
805 if (no_space_count)
806 *no_space_count = count;
808 }
809
810 // no maximum
811 if ((pProto->MaxCount <= 0 && pProto->ItemLimitCategory == 0) || pProto->MaxCount == 2147483647)
812 return EQUIP_ERR_OK;
813
814 if (pProto->MaxCount > 0)
815 {
816 uint32 curcount = GetItemCount(pProto->ItemId, true, pItem);
817 if (curcount + count > uint32(pProto->MaxCount))
818 {
819 if (no_space_count)
820 *no_space_count = count + curcount - pProto->MaxCount;
822 }
823 }
824
825 // check unique-equipped limit
826 if (pProto->ItemLimitCategory)
827 {
828 ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(pProto->ItemLimitCategory);
829 if (!limitEntry)
830 {
831 if (no_space_count)
832 *no_space_count = count;
834 }
835
836 if (limitEntry->mode == ITEM_LIMIT_CATEGORY_MODE_HAVE)
837 {
838 uint32 curcount = GetItemCountWithLimitCategory(pProto->ItemLimitCategory, pItem);
839 if (curcount + count > uint32(limitEntry->maxCount))
840 {
841 if (no_space_count)
842 *no_space_count = count + curcount - limitEntry->maxCount;
844 }
845 }
846 }
847
848 return EQUIP_ERR_OK;
849}
@ ITEM_LIMIT_CATEGORY_MODE_HAVE
Definition DBCEnums.h:379
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED
Definition Item.h:130
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item *skipItem=nullptr) const
Definition PlayerStorage.cpp:372
uint32 mode
Definition DBCStructure.h:1202

References EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED, EQUIP_ERR_OK, GetItemCount(), GetItemCountWithLimitCategory(), ITEM_LIMIT_CATEGORY_MODE_HAVE, ItemTemplate::ItemId, ItemTemplate::ItemLimitCategory, ItemTemplate::MaxCount, ItemLimitCategoryEntry::maxCount, ItemLimitCategoryEntry::mode, sItemLimitCategoryStore, and sObjectMgr.

◆ CanTakeQuest()

bool Player::CanTakeQuest ( Quest const *  quest,
bool  msg 
)
252{
253 return !sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
254 && SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
255 && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
256 && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
257 && SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
258 && SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
259 && SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
260 && SatisfyQuestMonth(quest, msg) && SatisfyQuestSeasonal(quest, msg)
261 && SatisfyQuestConditions(quest, msg);
262}
bool SatisfyQuestConditions(Quest const *qInfo, bool msg)
Definition PlayerQuest.cpp:1159
bool SatisfyQuestTimed(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1172
bool SatisfyQuestLevel(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:967
bool SatisfyQuestStatus(Quest const *qInfo, bool msg) const
Definition PlayerQuest.cpp:1148

References DISABLE_TYPE_QUEST, Quest::GetQuestId(), SatisfyQuestClass(), SatisfyQuestConditions(), SatisfyQuestDay(), SatisfyQuestExclusiveGroup(), SatisfyQuestLevel(), SatisfyQuestMonth(), SatisfyQuestNextChain(), SatisfyQuestPrevChain(), SatisfyQuestPreviousQuest(), SatisfyQuestRace(), SatisfyQuestReputation(), SatisfyQuestSeasonal(), SatisfyQuestSkill(), SatisfyQuestStatus(), SatisfyQuestTimed(), SatisfyQuestWeek(), and sDisableMgr.

Referenced by CanCompleteQuest(), CanCompleteRepeatableQuest(), Spell::EffectQuestComplete(), Spell::EffectQuestStart(), npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), npc_wg_quest_giver::OnGossipHello(), PrepareQuestMenu(), SendPreparedQuest(), and npc_costumed_orphan_matron::sGossipHello().

◆ CanTameExoticPets()

bool Player::CanTameExoticPets ( ) const
inline

◆ CanTeleport()

bool Player::CanTeleport ( )
inline
2514{ return m_canTeleport; }

References m_canTeleport.

◆ CanTitanGrip()

bool Player::CanTitanGrip ( ) const
inline

◆ CanUnequipItem()

InventoryResult Player::CanUnequipItem ( uint16  src,
bool  swap 
) const
1985{
1986 if (!sScriptMgr->OnPlayerCanUnequipItem(const_cast<Player*>(this), pos, swap))
1988
1989 // Applied only to equipped items and bank bags
1990 if (!IsEquipmentPos(pos) && !IsBagPos(pos))
1991 return EQUIP_ERR_OK;
1992
1993 Item* pItem = GetItemByPos(pos);
1994
1995 // Applied only to existed equipped item
1996 if (!pItem)
1997 return EQUIP_ERR_OK;
1998
1999 LOG_DEBUG("entities.player.items", "STORAGE: CanUnequipItem slot = {}, item = {}, count = {}", pos, pItem->GetEntry(), pItem->GetCount());
2000
2001 ItemTemplate const* pProto = pItem->GetTemplate();
2002 if (!pProto)
2004
2005 // item used
2006 if (pItem->m_lootGenerated)
2008
2009 // do not allow unequipping gear except weapons, offhands, projectiles, relics in
2010 // - combat
2011 // - in-progress arenas
2012 if (!pProto->CanChangeEquipStateInCombat())
2013 {
2014 if (IsInCombat())
2016
2017 if (Battleground* bg = GetBattleground())
2018 if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
2020 }
2021
2022 // Xinef: dont allow to unequip items on disarmed slot
2025
2026 if (!swap && pItem->IsNotEmptyBag())
2028
2029 return EQUIP_ERR_OK;
2030}

References ItemTemplate::CanChangeEquipStateInCombat(), Unit::CanUseAttackType(), EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NOT_DURING_ARENA_MATCH, EQUIP_ERR_NOT_IN_COMBAT, EQUIP_ERR_NOT_WHILE_DISARMED, EQUIP_ERR_OK, GetAttackBySlot(), GetBattleground(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), Item::GetSlot(), Item::GetTemplate(), IsBagPos(), IsEquipmentPos(), Unit::IsInCombat(), Item::IsNotEmptyBag(), LOG_DEBUG, Item::m_lootGenerated, sScriptMgr, and STATUS_IN_PROGRESS.

Referenced by CanEquipItem(), CanUnequipItems(), DestroyItemCount(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetUse(), and SwapItem().

◆ CanUnequipItems()

InventoryResult Player::CanUnequipItems ( uint32  item,
uint32  count 
) const
274{
275 uint32 tempcount = 0;
276
278
280 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
281 if (pItem->GetEntry() == item)
282 {
284 if (ires == EQUIP_ERR_OK)
285 {
286 tempcount += pItem->GetCount();
287 if (tempcount >= count)
288 return EQUIP_ERR_OK;
289 }
290 else
291 res = ires;
292 }
293
295 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
296 if (pItem->GetEntry() == item)
297 {
298 tempcount += pItem->GetCount();
299 if (tempcount >= count)
300 return EQUIP_ERR_OK;
301 }
302
304 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
305 if (pItem->GetEntry() == item)
306 {
307 tempcount += pItem->GetCount();
308 if (tempcount >= count)
309 return EQUIP_ERR_OK;
310 }
311
313 if (Bag* pBag = GetBagByPos(i))
314 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
315 if (Item* pItem = GetItemByPos(i, j))
316 if (pItem->GetEntry() == item)
317 {
318 tempcount += pItem->GetCount();
319 if (tempcount >= count)
320 return EQUIP_ERR_OK;
321 }
322
323 // not found req. item count and have unequippable items
324 return res;
325}
@ EQUIPMENT_SLOT_START
Definition Player.h:681

References CanUnequipItem(), CURRENCYTOKEN_SLOT_END, EQUIP_ERR_OK, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and KEYRING_SLOT_START.

Referenced by TakeQuestSourceItem().

◆ CanUninviteFromGroup()

PartyResult Player::CanUninviteFromGroup ( ObjectGuid  targetPlayerGUID = ObjectGuid::Empty) const
Todo:
: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
12977{
12978 Group const* grp = GetGroup();
12979 if (!grp)
12980 return ERR_NOT_IN_GROUP;
12981
12982 if (grp->isLFGGroup(true))
12983 {
12984 ObjectGuid gguid = grp->GetGUID();
12985 if (!sLFGMgr->GetKicksLeft(gguid))
12987
12988 lfg::LfgState state = sLFGMgr->GetState(gguid);
12989 if (state == lfg::LFG_STATE_BOOT)
12991
12994
12997
12998 if (grp->isRollLootActive())
13000
13002 for (GroupReference const* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
13003 if (itr->GetSource() && itr->GetSource()->IsInMap(this) && itr->GetSource()->IsInCombat())
13005
13006 if (Player* target = ObjectAccessor::FindConnectedPlayer(targetPlayerGUID))
13007 {
13008 if (Aura* dungeonCooldownAura = target->GetAura(lfg::LFG_SPELL_DUNGEON_COOLDOWN))
13009 {
13010 int32 elapsedTime = dungeonCooldownAura->GetMaxDuration() - dungeonCooldownAura->GetDuration();
13011 if (static_cast<int32>(sWorld->getIntConfig(CONFIG_LFG_KICK_PREVENTION_TIMER)) > elapsedTime)
13012 {
13014 }
13015 }
13016 }
13017
13018 /* Missing support for these types
13019 return ERR_PARTY_LFG_BOOT_COOLDOWN_S;
13020 */
13021 }
13022 else
13023 {
13024 if (!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
13025 return ERR_NOT_LEADER;
13026
13027 if (InBattleground())
13028 return ERR_INVITE_RESTRICTED;
13029 }
13030
13031 return ERR_PARTY_RESULT_OK;
13032}
@ ERR_PARTY_LFG_BOOT_LOOT_ROLLS
Definition SharedDefines.h:3987
@ ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S
Definition SharedDefines.h:3982
@ ERR_PARTY_LFG_BOOT_LIMIT
Definition SharedDefines.h:3978
@ ERR_NOT_LEADER
Definition SharedDefines.h:3967
@ ERR_NOT_IN_GROUP
Definition SharedDefines.h:3966
@ ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE
Definition SharedDefines.h:3986
@ ERR_PARTY_LFG_BOOT_IN_COMBAT
Definition SharedDefines.h:3984
@ ERR_PARTY_LFG_BOOT_IN_PROGRESS
Definition SharedDefines.h:3980
@ ERR_INVITE_RESTRICTED
Definition SharedDefines.h:3971
@ ERR_PARTY_RESULT_OK
Definition SharedDefines.h:3960
@ ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS
Definition SharedDefines.h:3981
@ CONFIG_LFG_KICK_PREVENTION_TIMER
Definition WorldConfig.h:373
Definition GroupReference.h:27
bool isLFGGroup(bool restricted=false) const
Definition Group.cpp:2264
bool IsAssistant(ObjectGuid guid) const
Definition Group.cpp:2354
bool isRollLootActive() const
Definition Group.cpp:2457
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:2340
ObjectGuid GetGUID() const
Definition Group.cpp:2305
uint32 GetMembersCount() const
Definition Group.h:245
GroupReference * GetFirstMember()
Definition Group.h:243
bool InBattleground() const
Definition Player.h:2270
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:257
LfgState
Definition LFG.h:67
@ LFG_STATE_FINISHED_DUNGEON
Definition LFG.h:74
@ LFG_STATE_BOOT
Definition LFG.h:72
@ LFG_SPELL_DUNGEON_COOLDOWN
Definition LFGMgr.h:52
@ LFG_GROUP_KICK_VOTES_NEEDED
Definition LFGMgr.h:55

References CONFIG_LFG_KICK_PREVENTION_TIMER, ERR_INVITE_RESTRICTED, ERR_NOT_IN_GROUP, ERR_NOT_LEADER, ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE, ERR_PARTY_LFG_BOOT_IN_COMBAT, ERR_PARTY_LFG_BOOT_IN_PROGRESS, ERR_PARTY_LFG_BOOT_LIMIT, ERR_PARTY_LFG_BOOT_LOOT_ROLLS, ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S, ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS, ERR_PARTY_RESULT_OK, ObjectAccessor::FindConnectedPlayer(), Group::GetFirstMember(), GetGroup(), Object::GetGUID(), Group::GetGUID(), Group::GetMembersCount(), InBattleground(), Group::IsAssistant(), Group::IsLeader(), Group::isLFGGroup(), Group::isRollLootActive(), lfg::LFG_GROUP_KICK_VOTES_NEEDED, lfg::LFG_SPELL_DUNGEON_COOLDOWN, lfg::LFG_STATE_BOOT, lfg::LFG_STATE_FINISHED_DUNGEON, sLFGMgr, and sWorld.

Referenced by WorldSession::HandleGroupUninviteGuidOpcode(), and WorldSession::HandleGroupUninviteOpcode().

◆ CanUseAmmo()

InventoryResult Player::CanUseAmmo ( uint32  item) const
2463{
2464 LOG_DEBUG("entities.player.items", "STORAGE: CanUseAmmo item = {}", item);
2465 if (!IsAlive())
2467 //if (isStunned())
2468 // return EQUIP_ERR_YOU_ARE_STUNNED;
2469 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
2470 if (pProto)
2471 {
2472 if (pProto->InventoryType != INVTYPE_AMMO)
2474
2475 InventoryResult res = CanUseItem(pProto);
2476 if (res != EQUIP_ERR_OK)
2477 return res;
2478
2479 /*if (GetReputationMgr().GetReputation() < pProto->RequiredReputation)
2480 return EQUIP_ERR_CANT_EQUIP_REPUTATION;
2481 */
2482
2483 // Requires No Ammo
2484 if (HasAura(46699))
2485 return EQUIP_ERR_BAG_FULL6;
2486
2487 return EQUIP_ERR_OK;
2488 }
2490}
@ INVTYPE_AMMO
Definition ItemTemplate.h:280
@ EQUIP_ERR_YOU_ARE_DEAD
Definition Item.h:85
@ EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE
Definition Item.h:54
@ EQUIP_ERR_BAG_FULL6
Definition Item.h:109

References CanUseItem(), EQUIP_ERR_BAG_FULL6, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE, EQUIP_ERR_YOU_ARE_DEAD, Unit::HasAura(), ItemTemplate::InventoryType, INVTYPE_AMMO, Unit::IsAlive(), LOG_DEBUG, and sObjectMgr.

Referenced by Create(), and SetAmmo().

◆ CanUseBattlegroundObject()

bool Player::CanUseBattlegroundObject ( GameObject gameobject) const
Bug:
sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet Note: Mount, stealth and invisibility will be removed when used
13186{
13187 // It is possible to call this method will a nullptr pointer, only skipping faction check.
13188 if (gameobject)
13189 {
13190 FactionTemplateEntry const* playerFaction = GetFactionTemplateEntry();
13191 FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION));
13192
13193 if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction))
13194 return false;
13195 }
13196
13202 return (!isTotalImmune() && // Damage immune
13203 !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // Still has recently held flag debuff
13204 IsAlive()); // Alive
13205}
@ SPELL_RECENTLY_DROPPED_FLAG
Definition Battleground.h:135
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
@ GAMEOBJECT_FACTION
Definition UpdateFields.h:402
bool isTotalImmune() const
Definition Player.cpp:13277
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:10095
Definition DBCStructure.h:939
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition DBCStructure.h:951

References GAMEOBJECT_FACTION, Unit::GetFactionTemplateEntry(), Object::GetUInt32Value(), Unit::HasAura(), Unit::IsAlive(), FactionTemplateEntry::IsFriendlyTo(), isTotalImmune(), sFactionTemplateStore, and SPELL_RECENTLY_DROPPED_FLAG.

Referenced by Spell::CheckCast(), and GameObject::Use().

◆ CanUseItem() [1/2]

InventoryResult Player::CanUseItem ( Item pItem,
bool  not_loading = true 
) const
Todo:
: when you right-click already equipped item it throws EQUIP_ERR_NO_REQUIRED_PROFICIENCY.
2220{
2221 if (pItem)
2222 {
2223 LOG_DEBUG("entities.player.items", "STORAGE: CanUseItem item = {}", pItem->GetEntry());
2224
2225 if (!IsAlive() && not_loading)
2227
2228 //if (isStunned())
2229 // return EQUIP_ERR_YOU_ARE_STUNNED;
2230
2231 ItemTemplate const* pProto = pItem->GetTemplate();
2232 if (pProto)
2233 {
2234 if (pItem->IsBindedNotWith(this))
2236
2237 InventoryResult res = CanUseItem(pProto);
2238 if (res != EQUIP_ERR_OK)
2239 return res;
2240
2241 if (pItem->GetSkill() != 0)
2242 {
2243 bool allowEquip = false;
2244 uint32 itemSkill = pItem->GetSkill();
2245 // Armor that is binded to account can "morph" from plate to mail, etc. if skill is not learned yet.
2246 if (pProto->Quality == ITEM_QUALITY_HEIRLOOM && pProto->Class == ITEM_CLASS_ARMOR && !HasSkill(itemSkill))
2247 {
2249
2250 // In fact it's a visual bug, everything works properly... I need sniffs of operations with
2251 // binded to account items from off server.
2252
2254 {
2255 allowEquip = (itemSkill == SKILL_PLATE_MAIL);
2256 }
2258 {
2259 allowEquip = (itemSkill == SKILL_MAIL);
2260 }
2261 }
2262 if (!allowEquip && GetSkillValue(itemSkill) == 0)
2264 }
2265
2268
2269 return EQUIP_ERR_OK;
2270 }
2271 }
2273}
@ EQUIP_ERR_CANT_EQUIP_REPUTATION
Definition Item.h:111
@ ITEM_QUALITY_HEIRLOOM
Definition SharedDefines.h:336
@ SKILL_PLATE_MAIL
Definition SharedDefines.h:3190
@ SKILL_MAIL
Definition SharedDefines.h:3201
uint32 GetSkill()
Definition Item.cpp:555
uint32 Quality
Definition ItemTemplate.h:626

References CanUseItem(), ItemTemplate::Class, CLASS_CONTEXT_EQUIP_ARMOR_CLASS, CLASS_HUNTER, CLASS_PALADIN, CLASS_SHAMAN, CLASS_WARRIOR, EQUIP_ERR_CANT_EQUIP_REPUTATION, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_DEAD, Object::GetEntry(), GetReputationRank(), Item::GetSkill(), GetSkillValue(), Item::GetTemplate(), HasSkill(), Unit::IsAlive(), Item::IsBindedNotWith(), IsClass(), ITEM_CLASS_ARMOR, ITEM_QUALITY_HEIRLOOM, LOG_DEBUG, ItemTemplate::Quality, ItemTemplate::RequiredReputationFaction, ItemTemplate::RequiredReputationRank, SKILL_MAIL, and SKILL_PLATE_MAIL.

Referenced by CanBankItem(), CanEquipItem(), CanUseAmmo(), CanUseItem(), WorldSession::HandleReadItem(), and WorldSession::HandleUseItemOpcode().

◆ CanUseItem() [2/2]

InventoryResult Player::CanUseItem ( ItemTemplate const *  pItem) const
2276{
2277 // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
2278
2279 if (!proto)
2280 {
2282 }
2283
2284 if (proto->HasFlag2(ITEM_FLAG2_FACTION_HORDE) && GetTeamId(true) != TEAM_HORDE)
2285 {
2287 }
2288
2289 if (proto->HasFlag2(ITEM_FLAG2_FACTION_ALLIANCE) && GetTeamId(true) != TEAM_ALLIANCE)
2290 {
2292 }
2293
2294 if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
2295 {
2297 }
2298
2299 if (proto->RequiredSkill != 0)
2300 {
2301 if (GetSkillValue(proto->RequiredSkill) == 0)
2302 {
2304 }
2305 else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
2306 {
2308 }
2309 }
2310
2311 if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
2312 {
2314 }
2315
2316 if (GetLevel() < proto->RequiredLevel)
2317 {
2319 }
2320
2321 // If World Event is not active, prevent using event dependant items
2322 if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
2323 {
2325 }
2326
2328
2329 if (!sScriptMgr->OnPlayerCanUseItem(const_cast<Player*>(this), proto, result))
2330 {
2331 return result;
2332 }
2333
2334 return EQUIP_ERR_OK;
2335}
bool IsHolidayActive(HolidayIds id)
Definition GameEventMgr.cpp:1950
@ EQUIP_ERR_CANT_EQUIP_LEVEL_I
Definition Item.h:48
HolidayIds
Definition SharedDefines.h:2980

References ItemTemplate::AllowableClass, ItemTemplate::AllowableRace, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_EQUIP_LEVEL_I, EQUIP_ERR_CANT_EQUIP_SKILL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM, Unit::getClassMask(), Unit::GetLevel(), Unit::getRaceMask(), GetSkillValue(), GetTeamId(), ItemTemplate::HasFlag2(), HasSpell(), ItemTemplate::HolidayId, IsHolidayActive(), ITEM_FLAG2_FACTION_ALLIANCE, ITEM_FLAG2_FACTION_HORDE, ItemTemplate::RequiredLevel, ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, ItemTemplate::RequiredSpell, sScriptMgr, TEAM_ALLIANCE, and TEAM_HORDE.

◆ CastItemCombatSpell() [1/2]

void Player::CastItemCombatSpell ( Unit target,
WeaponAttackType  attType,
uint32  procVictim,
uint32  procEx 
)
7214{
7215 if (!target || !target->IsAlive() || target == this)
7216 return;
7217
7218 // Xinef: do not use disarmed weapons, special exception - shaman ghost wolf form
7219 // Xinef: normal forms proc on hit enchants / built in item bonuses
7221 return;
7222
7224 {
7225 // If usable, try to cast item spell
7226 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
7227 if (!item->IsBroken())
7228 if (ItemTemplate const* proto = item->GetTemplate())
7229 {
7230 // Additional check for weapons
7231 if (proto->Class == ITEM_CLASS_WEAPON)
7232 {
7233 // offhand item cannot proc from main hand hit etc
7234 EquipmentSlots slot;
7235 switch (attType)
7236 {
7237 case BASE_ATTACK:
7239 break;
7240 case OFF_ATTACK:
7242 break;
7243 case RANGED_ATTACK:
7244 slot = EQUIPMENT_SLOT_RANGED;
7245 break;
7246 default:
7247 slot = EQUIPMENT_SLOT_END;
7248 break;
7249 }
7250 if (slot != i)
7251 continue;
7252 }
7253
7254 CastItemCombatSpell(target, attType, procVictim, procEx, item, proto);
7255 }
7256 }
7257}
EquipmentSlots
Definition Player.h:680
@ FORM_GHOSTWOLF
Definition UnitDefines.h:85
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition Player.cpp:7213

References BASE_ATTACK, Unit::CanUseAttackType(), CastItemCombatSpell(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, FORM_GHOSTWOLF, GetItemByPos(), Unit::GetShapeshiftForm(), INVENTORY_SLOT_BAG_0, Unit::IsAlive(), ITEM_CLASS_WEAPON, OFF_ATTACK, and RANGED_ATTACK.

Referenced by CastItemCombatSpell(), Unit::DealMeleeDamage(), and Spell::DoAllEffectOnTarget().

◆ CastItemCombatSpell() [2/2]

void Player::CastItemCombatSpell ( Unit target,
WeaponAttackType  attType,
uint32  procVictim,
uint32  procEx,
Item item,
ItemTemplate const *  proto 
)
7260{
7261 if (!sScriptMgr->OnPlayerCanCastItemCombatSpell(this, target, attType, procVictim, procEx, item, proto))
7262 return;
7263
7264 // Can do effect if any damage done to target
7265 if (procVictim & PROC_FLAG_TAKEN_DAMAGE)
7266 //if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
7267 {
7268 for (uint8 i = 0; i < MAX_ITEM_SPELLS; ++i)
7269 {
7270 _Spell const& spellData = proto->Spells[i];
7271
7272 // no spell
7273 if (!spellData.SpellId)
7274 continue;
7275
7276 // wrong triggering type
7278 continue;
7279
7280 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
7281 if (!spellInfo)
7282 {
7283 LOG_ERROR("entities.player", "WORLD: unknown Item spellid {}", spellData.SpellId);
7284 continue;
7285 }
7286
7287 float chance = (float)spellInfo->ProcChance;
7288
7289 if (spellData.SpellPPMRate)
7290 {
7291 uint32 WeaponSpeed = GetAttackTime(attType);
7292 chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
7293 }
7294 else if (chance > 100.0f)
7295 {
7296 chance = GetWeaponProcChance();
7297 }
7298
7299 if (roll_chance_f(chance) && sScriptMgr->OnCastItemCombatSpell(this, target, spellInfo, item))
7301 }
7302 }
7303
7304 // item combat enchantments
7305 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
7306 {
7307 uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
7308 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
7309 if (!pEnchant)
7310 continue;
7311
7312 for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
7313 {
7314 if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
7315 continue;
7316
7317 SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id);
7318
7319 if (entry && entry->procEx)
7320 {
7321 // Check hit/crit/dodge/parry requirement
7322 if ((entry->procEx & procEx) == 0)
7323 continue;
7324 }
7325 else
7326 {
7327 // Can do effect if any damage done to target
7328 if (!(procVictim & PROC_FLAG_TAKEN_DAMAGE))
7329 //if (!(damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE))
7330 continue;
7331 }
7332
7333 if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_WHITE_HIT) && (procVictim & SPELL_PROC_FLAG_MASK))
7334 continue;
7335
7336 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
7337 if (!spellInfo)
7338 {
7339 LOG_ERROR("entities.player", "Player::CastItemCombatSpell({}, name: {}, enchant: {}): unknown spell {} is casted, ignoring...",
7340 GetGUID().ToString(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
7341 continue;
7342 }
7343
7344 if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_EXCLUSIVE) != 0)
7345 {
7346 Unit* checkTarget = spellInfo->IsPositive() ? this : target;
7347 if (checkTarget->HasAura(spellInfo->Id, GetGUID()))
7348 {
7349 continue;
7350 }
7351 }
7352
7353 float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
7354
7355 if (entry)
7356 {
7357 if (entry->PPMChance)
7358 chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
7359 else if (entry->customChance)
7360 chance = (float)entry->customChance;
7361 }
7362
7363 // Apply spell mods
7364 ApplySpellMod(pEnchant->spellid[s], SPELLMOD_CHANCE_OF_SUCCESS, chance);
7365
7366 // Shiv has 100% chance to apply the poison
7367 if (FindCurrentSpellBySpellId(5938) && e_slot == TEMP_ENCHANTMENT_SLOT)
7368 chance = 100.0f;
7369
7370 if (roll_chance_f(chance))
7371 {
7372 // Xinef: implement enchant charges
7373 if (uint32 charges = item->GetEnchantmentCharges(EnchantmentSlot(e_slot)))
7374 {
7375 if (!--charges)
7376 {
7377 ApplyEnchantment(item, EnchantmentSlot(e_slot), false);
7378 item->ClearEnchantment(EnchantmentSlot(e_slot));
7379 }
7380 else
7381 item->SetEnchantmentCharges(EnchantmentSlot(e_slot), charges);
7382 }
7383
7384 Unit* unitTarget = spellInfo->IsPositive() ? this : target;
7386 }
7387 }
7388 }
7389}
@ ITEM_SPELLTRIGGER_CHANCE_ON_HIT
Definition ItemTemplate.h:79
bool roll_chance_f(float chance)
Definition Random.h:57
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition SpellDefines.h:94
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
Definition SpellDefines.h:135
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:137
@ SPELL_PROC_FLAG_MASK
Definition SpellMgr.h:156
@ ENCHANT_PROC_ATTR_WHITE_HIT
Definition SpellMgr.h:310
@ ENCHANT_PROC_ATTR_EXCLUSIVE
Definition SpellMgr.h:309
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
Definition Item.cpp:951
void ClearEnchantment(EnchantmentSlot slot)
Definition Item.cpp:960
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition Item.h:306
bool IsPositive() const
Definition SpellInfo.cpp:1237
uint32 ProcChance
Definition SpellInfo.h:356
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
Definition Unit.cpp:13536
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4200
float GetWeaponProcChance() const
Definition Unit.cpp:13525
Definition SpellMgr.h:314
uint32 procEx
Definition SpellMgr.h:317
uint32 attributeMask
Definition SpellMgr.h:318
uint32 customChance
Definition SpellMgr.h:315
float PPMChance
Definition SpellMgr.h:316
uint32 ID
Definition DBCStructure.h:1843
float SpellPPMRate
Definition ItemTemplate.h:594

References SpellItemEnchantmentEntry::amount, ApplyEnchantment(), ApplySpellMod(), SpellEnchantProcEntry::attributeMask, Unit::CastSpell(), Item::ClearEnchantment(), SpellEnchantProcEntry::customChance, ItemTemplate::Delay, ENCHANT_PROC_ATTR_EXCLUSIVE, ENCHANT_PROC_ATTR_WHITE_HIT, Unit::FindCurrentSpellBySpellId(), Unit::GetAttackTime(), Item::GetEnchantmentCharges(), Item::GetEnchantmentId(), Object::GetGUID(), WorldObject::GetName(), Unit::GetPPMProcChance(), Unit::GetWeaponProcChance(), Unit::HasAura(), SpellInfo::Id, SpellItemEnchantmentEntry::ID, SpellInfo::IsPositive(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, ITEM_SPELLTRIGGER_CHANCE_ON_HIT, LOG_ERROR, MAX_ENCHANTMENT_SLOT, MAX_ITEM_SPELLS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, SpellEnchantProcEntry::PPMChance, PROC_FLAG_TAKEN_DAMAGE, SpellInfo::ProcChance, SpellEnchantProcEntry::procEx, roll_chance_f(), Item::SetEnchantmentCharges(), SPELL_PROC_FLAG_MASK, _Spell::SpellId, SpellItemEnchantmentEntry::spellid, SPELLMOD_CHANCE_OF_SUCCESS, _Spell::SpellPPMRate, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, sSpellItemEnchantmentStore, sSpellMgr, TEMP_ENCHANTMENT_SLOT, Position::ToString(), TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD, and SpellItemEnchantmentEntry::type.

◆ CastItemUseSpell()

void Player::CastItemUseSpell ( Item item,
SpellCastTargets const &  targets,
uint8  cast_count,
uint32  glyphIndex 
)
7392{
7393 if (!sScriptMgr->OnPlayerCanCastItemUseSpell(this, item, targets, cast_count, glyphIndex))
7394 return;
7395
7396 ItemTemplate const* proto = item->GetTemplate();
7397 // special learning case
7398 if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
7399 {
7400 uint32 learn_spell_id = proto->Spells[0].SpellId;
7401 uint32 learning_spell_id = proto->Spells[1].SpellId;
7402
7403 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
7404 if (!spellInfo)
7405 {
7406 LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: {}) in have wrong spell id {}, ignoring ", proto->ItemId, learn_spell_id);
7407 SendEquipError(EQUIP_ERR_NONE, item, nullptr);
7408 return;
7409 }
7410
7411 Spell* spell = new Spell(this, spellInfo, TRIGGERED_NONE);
7412 spell->m_CastItem = item;
7413 spell->m_cast_count = cast_count; //set count of casts
7414 spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id);
7415 spell->prepare(&targets);
7416 return;
7417 }
7418
7419 // use triggered flag only for items with many spell casts and for not first cast
7420 uint8 count = 0;
7421
7422 std::list<Spell*> pushSpells;
7423 // item spells casted at use
7424 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
7425 {
7426 _Spell const& spellData = proto->Spells[i];
7427
7428 // no spell
7429 if (!spellData.SpellId)
7430 continue;
7431
7432 // wrong triggering type
7433 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
7434 continue;
7435
7436 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
7437 if (!spellInfo)
7438 {
7439 LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: {}) in have wrong spell id {}, ignoring", proto->ItemId, spellData.SpellId);
7440 continue;
7441 }
7442
7443 if (HasSpellCooldown(spellInfo->Id))
7444 {
7445 continue;
7446 }
7447
7448 if (!spellInfo->CheckElixirStacking(this))
7449 {
7450 Spell::SendCastResult(this, spellInfo, cast_count, SPELL_FAILED_AURA_BOUNCED);
7451 continue;
7452 }
7453
7454 Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
7455 spell->m_CastItem = item;
7456 spell->m_cast_count = cast_count; // set count of casts
7457 spell->m_glyphIndex = glyphIndex; // glyph index
7458 spell->InitExplicitTargets(targets);
7459
7460 // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects
7461 // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item
7462 // Xinef: there is one problem with scripts which wont be loaded at the moment of call
7463 SpellCastResult result = spell->CheckCast(true);
7464 if (result != SPELL_CAST_OK)
7465 {
7466 spell->SendCastResult(result);
7467 delete spell;
7468 continue;
7469 }
7470
7471 pushSpells.push_back(spell);
7472 //spell->prepare(&targets);
7473
7474 ++count;
7475 }
7476
7477 // Item enchantments spells casted at use
7478 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
7479 {
7480 uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
7481 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
7482 if (!pEnchant)
7483 continue;
7484 for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
7485 {
7486 if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL)
7487 continue;
7488
7489 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
7490 if (!spellInfo)
7491 {
7492 LOG_ERROR("entities.player", "Player::CastItemUseSpell Enchant {}, cast unknown spell {}", pEnchant->ID, pEnchant->spellid[s]);
7493 continue;
7494 }
7495
7496 if (HasSpellCooldown(spellInfo->Id))
7497 continue;
7498
7499 Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
7500 spell->m_CastItem = item;
7501 spell->m_cast_count = cast_count; // set count of casts
7502 spell->m_glyphIndex = glyphIndex; // glyph index
7503 spell->InitExplicitTargets(targets);
7504
7505 // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects
7506 // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item
7507 // Xinef: there is one problem with scripts which wont be loaded at the moment of call
7508 SpellCastResult result = spell->CheckCast(true);
7509 if (result != SPELL_CAST_OK)
7510 {
7511 spell->SendCastResult(result);
7512 delete spell;
7513 continue;
7514 }
7515
7516 pushSpells.push_back(spell);
7517 //spell->prepare(&targets);
7518
7519 ++count;
7520 }
7521 }
7522
7523 // xinef: send all spells in one go, prevents crash because container is not set
7524 for (std::list<Spell*>::const_iterator itr = pushSpells.begin(); itr != pushSpells.end(); ++itr)
7525 (*itr)->prepare(&targets);
7526}
@ EQUIP_ERR_NONE
Definition Item.h:106
SpellCastResult
Definition SharedDefines.h:948
@ SPELL_FAILED_AURA_BOUNCED
Definition SharedDefines.h:958
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
@ TRIGGERED_NONE
Definition SpellDefines.h:133
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16300
bool CheckElixirStacking(Unit const *caster) const
Definition SpellInfo.cpp:2893
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3471
void SetSpellValue(SpellValueMod mod, int32 value)
Definition Spell.cpp:8455
uint8 m_cast_count
Definition Spell.h:527
uint32 m_glyphIndex
Definition Spell.h:528
SpellCastResult CheckCast(bool strict)
Definition Spell.cpp:5660
void InitExplicitTargets(SpellCastTargets const &targets)
Definition Spell.cpp:717
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4676
Item * m_CastItem
Definition Spell.h:524

References Spell::CheckCast(), SpellInfo::CheckElixirStacking(), EQUIP_ERR_NONE, Item::GetEnchantmentId(), Item::GetTemplate(), HasSpellCooldown(), SpellInfo::Id, SpellItemEnchantmentEntry::ID, Spell::InitExplicitTargets(), ITEM_ENCHANTMENT_TYPE_USE_SPELL, ITEM_SPELLTRIGGER_ON_USE, ItemTemplate::ItemId, LOG_ERROR, Spell::m_cast_count, Spell::m_CastItem, Spell::m_glyphIndex, MAX_ENCHANTMENT_SLOT, MAX_ITEM_PROTO_SPELLS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, Spell::prepare(), Spell::SendCastResult(), SendEquipError(), Spell::SetSpellValue(), SPELL_CAST_OK, SPELL_FAILED_AURA_BOUNCED, _Spell::SpellId, SpellItemEnchantmentEntry::spellid, ItemTemplate::Spells, _Spell::SpellTrigger, SPELLVALUE_BASE_POINT0, sScriptMgr, sSpellItemEnchantmentStore, sSpellMgr, TRIGGERED_FULL_MASK, TRIGGERED_NONE, and SpellItemEnchantmentEntry::type.

Referenced by WorldSession::HandleUseItemOpcode().

◆ CharmSpellInitialize()

void Player::CharmSpellInitialize ( )
9687{
9688 Unit* charm = GetFirstControlled();
9689 if (!charm)
9690 return;
9691
9692 CharmInfo* charmInfo = charm->GetCharmInfo();
9693 if (!charmInfo)
9694 {
9695 LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm ({}) has no charminfo!", charm->GetGUID().ToString());
9696 return;
9697 }
9698
9699 uint8 addlist = 0;
9700 if (!charm->IsPlayer())
9701 {
9702 //CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureTemplate();
9703 //if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
9704 {
9705 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
9706 if (charmInfo->GetCharmSpell(i)->GetAction())
9707 ++addlist;
9708 }
9709 }
9710
9711 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 4 * addlist + 1);
9712 data << charm->GetGUID();
9713 data << uint16(0);
9714 data << uint32(0);
9715
9716 if (!charm->IsPlayer())
9717 data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
9718 else
9719 data << uint32(0);
9720
9721 charmInfo->BuildActionBar(&data);
9722
9723 data << uint8(addlist);
9724
9725 if (addlist)
9726 {
9727 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
9728 {
9729 CharmSpellInfo* cspell = charmInfo->GetCharmSpell(i);
9730 if (cspell->GetAction())
9731 data << uint32(cspell->packedData);
9732 }
9733 }
9734
9735 data << uint8(0); // cooldowns count
9736
9737 GetSession()->SendPacket(&data);
9738}
#define MAX_SPELL_CHARM
Definition CharmInfo.h:24
#define MAX_UNIT_ACTION_BAR_INDEX
Definition CharmInfo.h:29
ReactStates GetReactState() const
Definition Creature.h:96
CharmInfo * GetCharmInfo()
Definition Unit.h:1208
Unit * GetFirstControlled() const
Definition Unit.cpp:11161
@ SMSG_PET_SPELLS
Definition Opcodes.h:407
Definition CharmInfo.h:127
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition CharmInfo.h:158
CommandStates GetCommandState() const
Definition CharmInfo.h:136
void BuildActionBar(WorldPacket *data)
Definition CharmInfo.cpp:285
Definition CharmInfo.h:95
uint32 packedData
Definition CharmInfo.h:98
uint32 GetAction() const
Definition CharmInfo.h:102

References CharmInfo::BuildActionBar(), UnitActionBarEntry::GetAction(), Unit::GetCharmInfo(), CharmInfo::GetCharmSpell(), CharmInfo::GetCommandState(), Unit::GetFirstControlled(), Object::GetGUID(), Creature::GetReactState(), GetSession(), Object::IsPlayer(), LOG_ERROR, MAX_SPELL_CHARM, MAX_UNIT_ACTION_BAR_INDEX, UnitActionBarEntry::packedData, WorldSession::SendPacket(), SMSG_PET_SPELLS, Object::ToCreature(), and ObjectGuid::ToString().

Referenced by spell_mage_summon_water_elemental::HandleDummy(), WorldSession::HandleRequestPetInfo(), Unit::SetCharmedBy(), and Unit::SetMinion().

◆ CheckAllAchievementCriteria()

void Player::CheckAllAchievementCriteria ( )
13873{
13875}
void CheckAllAchievementCriteria()
Definition AchievementMgr.cpp:795

References AchievementMgr::CheckAllAchievementCriteria(), and m_achievementMgr.

Referenced by Create(), and WorldSession::HandlePlayerLoginFromDB().

◆ CheckAmmoCompatibility()

bool Player::CheckAmmoCompatibility ( ItemTemplate const *  ammo_proto) const
7670{
7671 if (!ammo_proto)
7672 return false;
7673
7674 // check ranged weapon
7676 if (!weapon || weapon->IsBroken())
7677 return false;
7678
7679 ItemTemplate const* weapon_proto = weapon->GetTemplate();
7680 if (!weapon_proto || weapon_proto->Class != ITEM_CLASS_WEAPON)
7681 return false;
7682
7683 // check ammo ws. weapon compatibility
7684 switch (weapon_proto->SubClass)
7685 {
7688 if (ammo_proto->SubClass != ITEM_SUBCLASS_ARROW)
7689 return false;
7690 break;
7692 if (ammo_proto->SubClass != ITEM_SUBCLASS_BULLET)
7693 return false;
7694 break;
7695 default:
7696 return false;
7697 }
7698
7699 return true;
7700}
@ ITEM_SUBCLASS_WEAPON_CROSSBOW
Definition ItemTemplate.h:362
@ ITEM_SUBCLASS_WEAPON_GUN
Definition ItemTemplate.h:347
@ ITEM_SUBCLASS_WEAPON_BOW
Definition ItemTemplate.h:346
@ ITEM_SUBCLASS_ARROW
Definition ItemTemplate.h:416
@ ITEM_SUBCLASS_BULLET
Definition ItemTemplate.h:417
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:488

References ItemTemplate::Class, Item::GetTemplate(), GetWeaponForAttack(), Item::IsBroken(), ITEM_CLASS_WEAPON, ITEM_SUBCLASS_ARROW, ITEM_SUBCLASS_BULLET, ITEM_SUBCLASS_WEAPON_BOW, ITEM_SUBCLASS_WEAPON_CROSSBOW, ITEM_SUBCLASS_WEAPON_GUN, RANGED_ATTACK, and ItemTemplate::SubClass.

Referenced by _ApplyAmmoBonuses().

◆ CheckAreaExploreAndOutdoor()

void Player::CheckAreaExploreAndOutdoor ( )
5749{
5750 if (!IsAlive())
5751 return;
5752
5753 if (IsInFlight())
5754 return;
5755
5756 bool isOutdoor = IsOutdoors();
5757 uint32 areaId = GetAreaId();
5758 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
5759
5760 if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && _wasOutdoor != isOutdoor)
5761 {
5762 _wasOutdoor = isOutdoor;
5763
5765 SpellAttr0 attrToRecalculate = isOutdoor ? SPELL_ATTR0_ONLY_OUTDOORS : SPELL_ATTR0_ONLY_INDOORS;
5766 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5767 {
5768 Aura* aura = iter->second->GetBase();
5769 SpellInfo const* spell = aura->GetSpellInfo();
5770 if (spell->Attributes & attrToRemove)
5771 {
5772 // if passive - do not remove and just turn off all effects
5773 if (aura->IsPassive())
5774 {
5775 aura->HandleAllEffects(iter->second, AURA_EFFECT_HANDLE_REAL, false);
5776 ++iter;
5777 continue;
5778 }
5779
5780 RemoveAura(iter);
5781 }
5782 else if ((spell->Attributes & attrToRecalculate) && aura->IsPassive())
5783 {
5784 // if passive - turn on all effects
5785 aura->HandleAllEffects(iter->second, AURA_EFFECT_HANDLE_REAL, true);
5786 ++iter;
5787 }
5788 else
5789 {
5790 ++iter;
5791 }
5792 }
5793 }
5794
5795 if (!sScriptMgr->OnPlayerCanAreaExploreAndOutdoor(this))
5796 return;
5797
5798 if (!areaId)
5799 return;
5800
5801 if (!areaEntry)
5802 {
5803 LOG_ERROR("entities.player", "Player '{}' ({}) discovered unknown area (x: {} y: {} z: {} map: {})",
5805 return;
5806 }
5807
5808 uint32 offset = areaEntry->exploreFlag / 32;
5809
5810 if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
5811 {
5812 LOG_ERROR("entities.player", "Wrong area flag {} in map data for (X: {} Y: {}) point to field PLAYER_EXPLORED_ZONES_1 + {} ( {} must be < {} ).", areaEntry->flags, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
5813 return;
5814 }
5815
5816 uint32 val = (uint32)(1 << (areaEntry->exploreFlag % 32));
5817 uint32 currFields = GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
5818
5819 if (!(currFields & val))
5820 {
5821 SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
5822
5824
5825 if (areaEntry->area_level > 0)
5826 {
5827 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
5828 {
5829 SendExplorationExperience(areaId, 0);
5830 }
5831 else
5832 {
5833 int32 diff = int32(GetLevel()) - areaEntry->area_level;
5834 uint32 XP = 0;
5835 if (diff < -5)
5836 {
5837 XP = uint32(sObjectMgr->GetBaseXP(GetLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE));
5838 }
5839 else if (diff > 5)
5840 {
5841 int32 exploration_percent = (100 - ((diff - 5) * 5));
5842 if (exploration_percent > 100)
5843 exploration_percent = 100;
5844 else if (exploration_percent < 0)
5845 exploration_percent = 0;
5846
5847 XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * exploration_percent / 100 * sWorld->getRate(RATE_XP_EXPLORE));
5848 }
5849 else
5850 {
5851 XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * sWorld->getRate(RATE_XP_EXPLORE));
5852 }
5853
5854 sScriptMgr->OnPlayerGiveXP(this, XP, nullptr, PlayerXPSource::XPSOURCE_EXPLORE);
5855 GiveXP(XP, nullptr);
5856 SendExplorationExperience(areaId, XP);
5857 }
5858 LOG_DEBUG("entities.player", "Player {} discovered a new area: {}", GetGUID().ToString(), areaId);
5859 }
5860 }
5861}
@ ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA
Definition DBCEnums.h:157
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ XPSOURCE_EXPLORE
Definition Player.h:1019
@ SPELL_ATTR0_ONLY_INDOORS
Definition SharedDefines.h:396
@ SPELL_ATTR0_ONLY_OUTDOORS
Definition SharedDefines.h:397
@ CONFIG_MAX_PLAYER_LEVEL
Definition WorldConfig.h:186
@ RATE_XP_EXPLORE
Definition WorldConfig.h:429
@ CONFIG_VMAP_INDOOR_CHECK
Definition WorldConfig.h:81
void HandleAllEffects(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuras.cpp:1241
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
bool IsPassive() const
Definition SpellAuras.cpp:1082
void SendExplorationExperience(uint32 Area, uint32 Experience)
Definition PlayerMisc.cpp:159
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f, bool isLFGReward=false)
Definition Player.cpp:2385
uint32 Attributes
Definition SpellInfo.h:324
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4832
bool IsInFlight() const
Definition Unit.h:1619
AuraApplicationMap m_appliedAuras
Definition Unit.h:2081
bool IsOutdoors() const
Definition Object.cpp:3046
Definition DBCStructure.h:519
int32 area_level
Definition DBCStructure.h:526
uint32 flags
Definition DBCStructure.h:524
uint32 exploreFlag
Definition DBCStructure.h:523

References _wasOutdoor, ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA, AreaTableEntry::area_level, SpellInfo::Attributes, AURA_EFFECT_HANDLE_REAL, CONFIG_MAX_PLAYER_LEVEL, CONFIG_VMAP_INDOOR_CHECK, AreaTableEntry::exploreFlag, AreaTableEntry::flags, WorldObject::GetAreaId(), Object::GetGUID(), Unit::GetLevel(), WorldLocation::GetMapId(), WorldObject::GetName(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Aura::GetSpellInfo(), Object::GetUInt32Value(), GiveXP(), Aura::HandleAllEffects(), Unit::IsAlive(), Unit::IsInFlight(), WorldObject::IsOutdoors(), Aura::IsPassive(), LOG_DEBUG, LOG_ERROR, Unit::m_appliedAuras, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, RATE_XP_EXPLORE, Unit::RemoveAura(), sAreaTableStore, SendExplorationExperience(), Unit::SetUInt32Value(), sObjectMgr, SPELL_ATTR0_ONLY_INDOORS, SPELL_ATTR0_ONLY_OUTDOORS, sScriptMgr, sWorld, Position::ToString(), UpdateAchievementCriteria(), and XPSOURCE_EXPLORE.

Referenced by UpdatePosition().

◆ CheckDuelDistance()

void Player::CheckDuelDistance ( time_t  currTime)
6403{
6404 if (!duel)
6405 {
6406 return;
6407 }
6408
6410 GameObject* obj = GetMap()->GetGameObject(duelFlagGUID);
6411 if (!obj)
6412 return;
6413
6414 if (!duel->OutOfBoundsTime)
6415 {
6416 if (!IsWithinDistInMap(obj, 50))
6417 {
6418 duel->OutOfBoundsTime = currTime + 10;
6419
6421 GetSession()->SendPacket(&data);
6422 }
6423 }
6424 else
6425 {
6426 if (IsWithinDistInMap(obj, 40))
6427 {
6428 duel->OutOfBoundsTime = 0;
6429
6431 GetSession()->SendPacket(&data);
6432 }
6433 else if (currTime >= duel->OutOfBoundsTime)
6435 }
6436}
@ DUEL_FLED
Definition SharedDefines.h:3869
@ PLAYER_DUEL_ARBITER
Definition UpdateFields.h:177
Definition GameObject.h:120
GameObject * GetGameObject(ObjectGuid const guid)
Definition Map.cpp:2287
void DuelComplete(DuelCompleteType type)
Definition Player.cpp:6443
std::unique_ptr< DuelInfo > duel
Definition Player.h:1891
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1289
@ SMSG_DUEL_INBOUNDS
Definition Opcodes.h:391
@ SMSG_DUEL_OUTOFBOUNDS
Definition Opcodes.h:390

References duel, DUEL_FLED, DuelComplete(), Map::GetGameObject(), Object::GetGuidValue(), WorldObject::GetMap(), GetSession(), WorldObject::IsWithinDistInMap(), PLAYER_DUEL_ARBITER, WorldSession::SendPacket(), SMSG_DUEL_INBOUNDS, and SMSG_DUEL_OUTOFBOUNDS.

Referenced by Update().

◆ CheckInstanceCount()

bool Player::CheckInstanceCount ( uint32  instanceId) const
6996{
6997 if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR))
6998 return true;
6999 return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end();
7000}
@ CONFIG_MAX_INSTANCES_PER_HOUR
Definition WorldConfig.h:319

References _instanceResetTimes, CONFIG_MAX_INSTANCES_PER_HOUR, and sWorld.

Referenced by MapMgr::PlayerCannotEnter().

◆ CheckInstanceLoginValid()

bool Player::CheckInstanceLoginValid ( )
6967{
6968 if (!GetMap())
6969 return false;
6970
6971 if (!GetMap()->IsDungeon() || IsGameMaster())
6972 return true;
6973
6974 if (GetMap()->IsRaid())
6975 {
6976 // cannot be in raid instance without a group
6977 if (!GetGroup() && !sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_RAID))
6978 return false;
6979 }
6980 else
6981 {
6982 // cannot be in normal instance without a group and more players than 1 in instance
6983 if (!GetGroup() && GetMap()->GetPlayersCountExceptGMs() > 1)
6984 return false;
6985 }
6986
6987 // pussywizard: check CanEnter for GetMap(), because in PlayerCannotEnter it is called for a map decided before loading screen (can change)
6988 if (GetMap()->CannotEnter(this, true))
6989 return false;
6990
6991 // do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
6992 return sMapMgr->PlayerCannotEnter(GetMap()->GetId(), this, true) == Map::CAN_ENTER;
6993}
#define sMapMgr
Definition MapMgr.h:220
@ CONFIG_INSTANCE_IGNORE_RAID
Definition WorldConfig.h:44
@ CAN_ENTER
Definition Map.h:266
uint32 GetId(std::string const &username)
Definition AccountMgr.cpp:236

References Map::CAN_ENTER, CONFIG_INSTANCE_IGNORE_RAID, GetGroup(), WorldObject::GetMap(), IsGameMaster(), sMapMgr, and sWorld.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ CheckSkillLearnedBySpell()

bool Player::CheckSkillLearnedBySpell ( uint32  spellId)
3110{
3112 return true;
3113
3114 SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
3115 uint32 errorSkill = 0;
3116 for (SkillLineAbilityMap::const_iterator sla = skill_bounds.first; sla != skill_bounds.second; ++sla)
3117 {
3118 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(sla->second->SkillLine);
3119 if (!pSkill)
3120 continue;
3121
3122 if (GetSkillRaceClassInfo(pSkill->id, getRace(), getClass()))
3123 return true;
3124 else
3125 errorSkill = pSkill->id;
3126 }
3127
3128 if (errorSkill)
3129 {
3130 LOG_ERROR("entities.player", "Player {} (GUID: {}), has spell ({}) that teach skill ({}) which is invalid for the race/class combination (Race: {}, Class: {}). Will be deleted.",
3131 GetName(), GetGUID().GetCounter(), spellId, errorSkill, getRace(), getClass());
3132
3133 return false;
3134 }
3135 return true;
3136}
@ CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS
Definition WorldConfig.h:477

References CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS, Unit::getClass(), Object::GetGUID(), WorldObject::GetName(), Unit::getRace(), GetSkillRaceClassInfo(), SkillLineEntry::id, LOG_ERROR, sSkillLineStore, sSpellMgr, and sWorld.

Referenced by _LoadSpells().

◆ CleanupAfterTaxiFlight()

void Player::CleanupAfterTaxiFlight ( )
10420{
10421 // For spells that trigger flying paths remove them at arrival
10423 {
10426 }
10427 m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
10428 Dismount();
10431}
@ UNIT_FLAG_TAXI_FLIGHT
Definition UnitDefines.h:270
void setOnlineOfflineState(bool isOnline)
Definition HostileRefMgr.cpp:98
void Dismount()
Definition Unit.cpp:13609
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:902

References PlayerTaxi::ClearTaxiDestinations(), Unit::Dismount(), Unit::getHostileRefMgr(), m_flightSpellActivated, m_taxi, Unit::RemoveAurasDueToSpell(), Unit::RemoveUnitFlag(), HostileRefMgr::setOnlineOfflineState(), UNIT_FLAG_DISABLE_MOVE, and UNIT_FLAG_TAXI_FLIGHT.

Referenced by go_commandscript::DoTeleport(), misc_commandscript::HandleAppearCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveWorldportAck(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), and TeleportTo().

◆ CleanupChannels()

void Player::CleanupChannels ( )
5036{
5037 while (!m_channels.empty())
5038 {
5039 Channel* ch = *m_channels.begin();
5040 m_channels.erase(m_channels.begin()); // remove from player's channel list
5041 ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list
5042 }
5043}
Definition Channel.h:144
void LeaveChannel(Player *player, bool send=true)
Definition Channel.cpp:249
JoinedChannelsList m_channels
Definition Player.h:2867

References Channel::LeaveChannel(), and m_channels.

Referenced by WorldSession::HandlePlayerLoginToCharInWorld(), and WorldSession::LogoutPlayer().

◆ CleanupsBeforeDelete()

void Player::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

471{
472 TradeCancel(false);
474
475 Unit::CleanupsBeforeDelete(finalCleanup);
476}
@ DUEL_INTERRUPTED
Definition SharedDefines.h:3867
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition Unit.cpp:15849

References Unit::CleanupsBeforeDelete(), DUEL_INTERRUPTED, DuelComplete(), and TradeCancel().

Referenced by WorldSession::LogoutPlayer().

◆ ClearAfkReports()

void Player::ClearAfkReports ( )
inline
2302{ m_bgData.bgAfkReporter.clear(); }
GuidSet bgAfkReporter
Definition Player.h:1049

References BGData::bgAfkReporter, and m_bgData.

Referenced by Battleground::RemovePlayerAtLeave().

◆ ClearChannelWatch()

void Player::ClearChannelWatch ( )
5046{
5047 for (JoinedChannelsList::iterator itr = m_channels.begin(); itr != m_channels.end(); ++itr)
5048 (*itr)->RemoveWatching(this);
5049}

References m_channels.

Referenced by WorldSession::HandleSetChannelWatch().

◆ ClearReceivedSpectatorResetFor()

void Player::ClearReceivedSpectatorResetFor ( )
inline

◆ clearResurrectRequestData()

void Player::clearResurrectRequestData ( )
inline
1839{ setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
static ObjectGuid const Empty
Definition ObjectGuid.h:120
void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
Definition Player.h:1829

References ObjectGuid::Empty, and setResurrectRequestData().

Referenced by WorldSession::HandleResurrectResponseOpcode(), Player(), and setDeathState().

◆ ClearWhisperWhiteList()

void Player::ClearWhisperWhiteList ( )
inline
2575{ WhisperList.clear(); }

References WhisperList.

Referenced by message_commandscript::HandleWhispersCommand().

◆ CompletedAchievement()

void Player::CompletedAchievement ( AchievementEntry const *  entry)
13908{
13910}
void CompletedAchievement(AchievementEntry const *entry)
Definition AchievementMgr.cpp:2265

References AchievementMgr::CompletedAchievement(), and m_achievementMgr.

Referenced by achievement_commandscript::HandleAchievementAddCommand(), and ArenaSeasonTeamRewarderImpl::RewardWithAchievements().

◆ CompleteQuest()

void Player::CompleteQuest ( uint32  quest_id)
599{
600 if (!quest_id)
601 {
602 return;
603 }
604
605 if (!sScriptMgr->OnPlayerBeforeQuestComplete(this, quest_id))
606 {
607 return;
608 }
609
611
612 auto log_slot = FindQuestSlot(quest_id);
613 if (log_slot < MAX_QUEST_LOG_SIZE)
614 {
616 }
617
618 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
619 if (qInfo && qInfo->HasFlag(QUEST_FLAGS_TRACKING))
620 {
621 RewardQuest(qInfo, 0, this, false);
622 }
623
624 // Xinef: area auras may change on quest completion!
628
629 // check if Quest Tracker is enabled
630 if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
631 {
632 // prepare Quest Tracker datas
633 auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
634 stmt->SetData(0, quest_id);
635 stmt->SetData(1, GetGUID().GetCounter());
636
637 // add to Quest Tracker
638 CharacterDatabase.Execute(stmt);
639 }
640}
@ CHAR_UPD_QUEST_TRACK_COMPLETE_TIME
Definition CharacterDatabase.h:505
@ ADDITIONAL_SAVING_INVENTORY_AND_GOLD
Definition Player.h:999
@ QUEST_FLAGS_TRACKING
Definition QuestDef.h:142
void RewardQuest(Quest const *quest, uint32 reward, Object *questGiver, bool announce=true, bool isLFGReward=false)
Definition PlayerQuest.cpp:659
void SetQuestStatus(uint32 questId, QuestStatus status, bool update=true)
Definition PlayerQuest.cpp:1479

References ADDITIONAL_SAVING_INVENTORY_AND_GOLD, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CHAR_UPD_QUEST_TRACK_COMPLETE_TIME, CharacterDatabase, CONFIG_QUEST_ENABLE_QUEST_TRACKER, FindQuestSlot(), WorldObject::GetAreaId(), Object::GetGUID(), WorldObject::GetZoneId(), Quest::HasFlag(), MAX_QUEST_LOG_SIZE, QUEST_FLAGS_TRACKING, QUEST_STATE_COMPLETE, QUEST_STATUS_COMPLETE, RewardQuest(), SetQuestSlotState(), SetQuestStatus(), sObjectMgr, sScriptMgr, sWorld, UpdateAreaDependentAuras(), and UpdateZoneDependentAuras().

Referenced by AddQuestAndCheckCompletion(), AreaExploredOrEventHappens(), WorldSession::HandleQuestgiverRequestRewardOpcode(), ItemAddedQuestCheck(), KillCreditGO(), KilledMonsterCredit(), KilledPlayerCreditForQuest(), MoneyChanged(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_plucky::OnGossipSelect(), ReputationChanged(), ReputationChanged2(), PlayerMenu::SendQuestGiverRequestItems(), TalkedToCreature(), and npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI().

◆ ContinueTaxiFlight()

void Player::ContinueTaxiFlight ( )
10434{
10435 uint32 sourceNode = m_taxi.GetTaxiSource();
10436 if (!sourceNode)
10437 return;
10438
10439 LOG_DEBUG("entities.unit", "WORLD: Restart character {} taxi flight", GetGUID().ToString());
10440
10441 uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(true), true);
10442 if (!mountDisplayId)
10443 return;
10444
10446
10447 // search appropriate start path node
10448 uint32 startNode = 0;
10449
10450 TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
10451
10452 float bestDist = SIZE_OF_GRIDS * SIZE_OF_GRIDS; // xinef: large value
10453 float currDist = 0.0f;
10454
10455 // xinef: changed to -1, we dont want to catch last node
10456 for (uint32 i = 0; i < nodeList.size() - 1; ++i)
10457 {
10458 TaxiPathNodeEntry const* node = nodeList[i];
10459 TaxiPathNodeEntry const* nextNode = nodeList[i + 1];
10460
10461 // xinef: skip nodes at another map, get last valid node on current map
10462 if (nextNode->mapid != GetMapId() || node->mapid != GetMapId())
10463 continue;
10464
10465 currDist = (node->x - GetPositionX()) * (node->x - GetPositionX()) + (node->y - GetPositionY()) * (node->y - GetPositionY()) + (node->z - GetPositionZ()) * (node->z - GetPositionZ());
10466 if (currDist < bestDist)
10467 {
10468 startNode = i;
10469 bestDist = currDist;
10470 }
10471 }
10472
10473 // xinef: no proper node was found
10474 if (startNode == 0)
10475 {
10477 return;
10478 }
10479
10481 {
10483 }
10484
10485 if (IsMounted())
10486 {
10488 }
10489
10490 SetCanTeleport(true);
10491
10492 GetSession()->SendDoFlight(mountDisplayId, path, startNode);
10493}
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition DBCStores.cpp:187
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition DBCStructure.h:2246
#define SIZE_OF_GRIDS
Definition MapDefines.h:26
uint32 GetTaxiSource() const
Definition PlayerTaxi.h:63
uint32 GetCurrentTaxiPath() const
Definition PlayerTaxi.cpp:213
void SetCanTeleport(bool value)
Definition Player.h:2515
Definition DBCStructure.h:1974
float y
Definition DBCStructure.h:1980
float x
Definition DBCStructure.h:1979
uint32 mapid
Definition DBCStructure.h:1978
float z
Definition DBCStructure.h:1981

References PlayerTaxi::ClearTaxiDestinations(), PlayerTaxi::GetCurrentTaxiPath(), Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), PlayerTaxi::GetTaxiSource(), GetTeamId(), Unit::IsInDisallowedMountForm(), Unit::IsMounted(), LOG_DEBUG, m_taxi, TaxiPathNodeEntry::mapid, Unit::RemoveAurasByType(), WorldSession::SendDoFlight(), SetCanTeleport(), SIZE_OF_GRIDS, sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sTaxiPathNodesByPath, Position::ToString(), TaxiPathNodeEntry::x, TaxiPathNodeEntry::y, and TaxiPathNodeEntry::z.

Referenced by WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), and ProcessDelayedOperations().

◆ ConvertRune()

void Player::ConvertRune ( uint8  index,
RuneType  newType 
)
13384{
13385 SetCurrentRune(index, newType);
13386
13388 data << uint8(index);
13389 data << uint8(newType);
13390 GetSession()->SendPacket(&data);
13391}
void SetCurrentRune(uint8 index, RuneType currentRune)
Definition Player.h:2532
@ SMSG_CONVERT_RUNE
Definition Opcodes.h:1188

References GetSession(), WorldSession::SendPacket(), SetCurrentRune(), and SMSG_CONVERT_RUNE.

Referenced by AddRuneByAuraEffect(), RemoveRunesByAuraEffect(), and RestoreBaseRune().

◆ CorrectMetaGemEnchants()

void Player::CorrectMetaGemEnchants ( uint8  slot,
bool  apply 
)
11188{
11189 //cycle all equipped items
11190 for (uint32 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
11191 {
11192 //enchants for the slot being socketed are handled by Player::ApplyItemMods
11193 if (slot == exceptslot)
11194 continue;
11195
11196 Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
11197
11198 if (!pItem || !pItem->HasSocket())
11199 continue;
11200
11201 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
11202 {
11203 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11204 if (!enchant_id)
11205 continue;
11206
11207 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11208 if (!enchantEntry)
11209 continue;
11210
11211 uint32 condition = enchantEntry->EnchantmentCondition;
11212 if (condition)
11213 {
11214 //was enchant active with/without item?
11215 bool wasactive = EnchantmentFitsRequirements(condition, apply ? exceptslot : -1);
11216 //should it now be?
11217 if (wasactive ^ EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
11218 {
11219 // ignore item gem conditions
11220 //if state changed, (dis)apply enchant
11221 ApplyEnchantment(pItem, EnchantmentSlot(enchant_slot), !wasactive, true, true);
11222 }
11223 }
11224 }
11225 }
11226}

References ApplyEnchantment(), SpellItemEnchantmentEntry::EnchantmentCondition, EnchantmentFitsRequirements(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetEnchantmentId(), GetItemByPos(), Item::HasSocket(), INVENTORY_SLOT_BAG_0, SOCK_ENCHANTMENT_SLOT, and sSpellItemEnchantmentStore.

Referenced by _ApplyItemMods().

◆ Create()

bool Player::Create ( ObjectGuid::LowType  guidlow,
CharacterCreateInfo createInfo 
)
Todo:
: need more checks against packet modifications
479{
480 // FIXME: outfitId not used in player creating
482 // should check that skin, face, hair* are valid via DBC per race/class
483 // also do it in Player::BuildEnumData, Player::LoadFromDB
484
486
487 m_name = createInfo->Name;
488
489 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class);
490 if (!info)
491 {
492 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid race/class pair ({}/{}) - refusing to do so.",
493 GetSession()->GetAccountId(), m_name, createInfo->Race, createInfo->Class);
494 return false;
495 }
496
497 for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
498 m_items[i] = nullptr;
499
500 Relocate(info->positionX, info->positionY, info->positionZ, info->orientation);
501
502 ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class);
503 if (!cEntry)
504 {
505 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid character class ({}) - refusing to do so (wrong DBC-files?)",
506 GetSession()->GetAccountId(), m_name, createInfo->Class);
507 return false;
508 }
509
510 SetMap(sMapMgr->CreateMap(info->mapId, this));
511
512 uint8 powertype = cEntry->powerType;
513
514 SetObjectScale(1.0f);
515
516 m_realRace = createInfo->Race; // set real race flag
517 m_race = createInfo->Race; // set real race flag
518
519 SetFactionForRace(createInfo->Race);
520
521 if (!IsValidGender(createInfo->Gender))
522 {
523 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid gender ({}) - refusing to do so",
524 GetSession()->GetAccountId(), m_name, createInfo->Gender);
525 return false;
526 }
527
528 uint32 RaceClassGender = (createInfo->Race) | (createInfo->Class << 8) | (createInfo->Gender << 16);
529
530 SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24)));
532 if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP)
533 {
536 }
538 SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
539 SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
540
541 // -1 is default value
543
544 SetUInt32Value(PLAYER_BYTES, (createInfo->Skin | (createInfo->Face << 8) | (createInfo->HairStyle << 16) | (createInfo->HairColor << 24)));
546 (0x00 << 8) |
547 (0x00 << 16) |
548 (((GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0) ? REST_STATE_RAF_LINKED : REST_STATE_NOT_RAF_LINKED) << 24)));
549 SetByteValue(PLAYER_BYTES_3, 0, createInfo->Gender);
550 SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1)
551
555
556 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
557 SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled
559
564
565 // set starting level
567 ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
569
571 {
572 uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
573 if (gm_level > start_level)
574 start_level = gm_level;
575 }
576
577 SetUInt32Value(UNIT_FIELD_LEVEL, start_level);
578
579 InitRunes();
580
582 ? sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY)
586
587 // Played time
591
592 // base stats and related field values
597 InitPrimaryProfessions(); // to max set before any spell added
598
599 // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
601 {
602 UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect)
604 }
605
607 {
612 }
613
614 // original spells
617
618 // original action bar
619 for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
620 addActionButton(action_itr->button, action_itr->action, action_itr->type);
621
622 // original items
623 if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender))
624 {
625 for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
626 {
627 if (oEntry->ItemId[j] <= 0)
628 continue;
629
630 uint32 itemId = oEntry->ItemId[j];
631
632 // just skip, reported in ObjectMgr::LoadItemTemplates
633 ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(itemId);
634 if (!iProto)
635 continue;
636
637 // BuyCount by default
638 uint32 count = iProto->BuyCount;
639
640 // special amount for food/drink
641 if (iProto->Class == ITEM_CLASS_CONSUMABLE && iProto->SubClass == ITEM_SUBCLASS_FOOD)
642 {
643 switch (iProto->Spells[0].SpellCategory)
644 {
645 case SPELL_CATEGORY_FOOD: // food
647 break;
648 case SPELL_CATEGORY_DRINK: // drink
649 count = 2;
650 break;
651 }
652 if (iProto->GetMaxStackSize() < count)
653 count = iProto->GetMaxStackSize();
654 }
655 StoreNewItemInBestSlots(itemId, count);
656 }
657 }
658
659 for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr != info->item.end(); ++item_id_itr)
660 StoreNewItemInBestSlots(item_id_itr->item_id, item_id_itr->item_amount);
661
662 // bags and main-hand weapon must equipped at this moment
663 // now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon)
664 // or ammo not equipped in special bag
666 {
667 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
668 {
669 uint16 eDest;
670 // equip offhand weapon/shield if it attempt equipped before main-hand weapon
671 InventoryResult msg = CanEquipItem(NULL_SLOT, eDest, pItem, false);
672 if (msg == EQUIP_ERR_OK)
673 {
675 EquipItem(eDest, pItem, true);
676 }
677 // move other items to more appropriate slots (ammo not equipped in special bag)
678 else
679 {
680 ItemPosCountVec sDest;
681 msg = CanStoreItem(NULL_BAG, NULL_SLOT, sDest, pItem, false);
682 if (msg == EQUIP_ERR_OK)
683 {
685 pItem = StoreItem(sDest, pItem, true);
686 }
687
688 // if this is ammo then use it
689 msg = CanUseAmmo(pItem->GetEntry());
690 if (msg == EQUIP_ERR_OK)
691 SetAmmo(pItem->GetEntry());
692 }
693 }
694 }
695 // all item positions resolved
696
697 // ensure player starts with full health
700
702
703 return true;
704}
CharStartOutfitEntry const * GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender)
Definition DBCStores.cpp:842
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesEntryfmt)
#define MAX_OUTFIT_ITEMS
Definition DBCStructure.h:617
@ ITEM_CLASS_CONSUMABLE
Definition ItemTemplate.h:291
@ ITEM_SUBCLASS_FOOD
Definition ItemTemplate.h:319
@ REST_STATE_RAF_LINKED
Definition Player.h:993
@ REST_STATE_NOT_RAF_LINKED
Definition Player.h:992
@ REALM_TYPE_RPPVP
Definition Realm.h:58
@ REALM_TYPE_PVP
Definition Realm.h:55
@ POWER_RUNIC_POWER
Definition SharedDefines.h:275
@ POWER_RUNE
Definition SharedDefines.h:274
@ SPELL_CATEGORY_DRINK
Definition SharedDefines.h:344
@ SPELL_CATEGORY_FOOD
Definition SharedDefines.h:343
@ CLASS_CONTEXT_INIT
Definition UnitDefines.h:227
@ UNIT_FLAG2_REGENERATE_POWER
Definition UnitDefines.h:299
@ UNIT_BYTE2_FLAG_PVP
Definition UnitDefines.h:136
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:253
@ PLAYER_GUILD_TIMESTAMP
Definition UpdateFields.h:185
@ PLAYER_GUILDID
Definition UpdateFields.h:179
@ PLAYER_FIELD_COINAGE
Definition UpdateFields.h:359
@ UNIT_FIELD_BYTES_0
Definition UpdateFields.h:95
@ UNIT_FIELD_LEVEL
Definition UpdateFields.h:114
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137
@ PLAYER_GUILDRANK
Definition UpdateFields.h:180
@ UNIT_FIELD_HOVERHEIGHT
Definition UpdateFields.h:173
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
@ CONFIG_START_HEROIC_PLAYER_MONEY
Definition WorldConfig.h:191
@ CONFIG_GAME_TYPE
Definition WorldConfig.h:168
@ CONFIG_START_GM_LEVEL
Definition WorldConfig.h:210
@ CONFIG_START_HEROIC_PLAYER_LEVEL
Definition WorldConfig.h:189
@ CONFIG_START_ARENA_POINTS
Definition WorldConfig.h:196
@ CONFIG_START_PLAYER_MONEY
Definition WorldConfig.h:190
@ CONFIG_START_PLAYER_LEVEL
Definition WorldConfig.h:188
@ CONFIG_START_HONOR_POINTS
Definition WorldConfig.h:194
uint8 HairColor
Definition WorldSession.h:281
uint8 Skin
Definition WorldSession.h:278
uint8 Class
Definition WorldSession.h:276
std::string Name
User specified variables.
Definition WorldSession.h:274
uint8 FacialHair
Definition WorldSession.h:282
uint8 HairStyle
Definition WorldSession.h:280
uint8 Face
Definition WorldSession.h:279
uint8 Gender
Definition WorldSession.h:277
uint8 Race
Definition WorldSession.h:275
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition Object.cpp:123
void SetInt32Value(uint16 index, int32 value)
Definition Object.cpp:626
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
void SetUInt64Value(uint16 index, uint64 value)
Definition Object.cpp:660
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:900
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count)
Definition Player.cpp:706
void InitPrimaryProfessions()
Definition Player.cpp:11479
void InitGlyphsForLevel()
Definition Player.cpp:13252
void UpdateMaxPower(Powers power) override
Definition StatSystem.cpp:326
void LearnCustomSpells()
Definition Player.cpp:11806
void SetArenaPoints(uint32 value)
Definition Player.cpp:6295
void SetObjectScale(float scale) override
Definition Player.h:1097
void InitDisplayIds()
Definition Player.cpp:10597
InventoryResult CanUseAmmo(uint32 item) const
Definition PlayerStorage.cpp:2462
void SetAmmo(uint32 item)
Definition PlayerStorage.cpp:2492
void SetHonorPoints(uint32 value)
Definition Player.cpp:6274
void InitTaxiNodesForLevel()
Definition Player.h:1163
void InitStatsForLevel(bool reapplyMods=false)
Definition Player.cpp:2588
Item * EquipItem(uint16 pos, Item *pItem, bool update)
Definition PlayerStorage.cpp:2727
void InitRunes()
Definition Player.cpp:13422
void SetMap(Map *map) override
Definition Player.cpp:14643
void SetFactionForRace(uint8 race)
Definition Player.cpp:5882
void CheckAllAchievementCriteria()
Definition Player.cpp:13872
bool HasActivePowerType(Powers power) override
Definition Player.cpp:2756
void LearnDefaultSkills()
Definition Player.cpp:11832
void SetFullHealth()
Definition Unit.h:1049
uint8 m_realRace
Definition Unit.h:2055
uint8 m_race
Definition Unit.h:2056
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:709
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:15709
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:703
Definition DBCStructure.h:620
Definition DBCStructure.h:653
uint32 powerType
Definition DBCStructure.h:656
float orientation
Definition Player.h:350
PlayerCreateInfoActions action
Definition Player.h:356
PlayerCreateInfoItems item
Definition Player.h:353
void Relocate(float x, float y)
Definition Position.h:77
uint32 SpellCategory
Definition ItemTemplate.h:596

References Object::_Create(), PlayerInfo::action, addActionButton(), ItemTemplate::BuyCount, CanEquipItem(), CanStoreItem(), CanUseAmmo(), CheckAllAchievementCriteria(), ItemTemplate::Class, CharacterCreateInfo::Class, CLASS_CONTEXT_INIT, CLASS_DEATH_KNIGHT, CONFIG_GAME_TYPE, CONFIG_START_ARENA_POINTS, CONFIG_START_GM_LEVEL, CONFIG_START_HEROIC_PLAYER_LEVEL, CONFIG_START_HEROIC_PLAYER_MONEY, CONFIG_START_HONOR_POINTS, CONFIG_START_PLAYER_LEVEL, CONFIG_START_PLAYER_MONEY, EQUIP_ERR_OK, EquipItem(), CharacterCreateInfo::Face, CharacterCreateInfo::FacialHair, CharacterCreateInfo::Gender, GetCharStartOutfitEntry(), GameTime::GetGameTime(), GetItemByPos(), Unit::GetMaxPower(), ItemTemplate::GetMaxStackSize(), GetSession(), CharacterCreateInfo::HairColor, CharacterCreateInfo::HairStyle, HasActivePowerType(), InitDisplayIds(), InitGlyphsForLevel(), InitPrimaryProfessions(), InitRunes(), InitStatsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, IsClass(), AccountMgr::IsPlayerAccount(), IsValidGender(), PlayerInfo::item, ITEM_CLASS_CONSUMABLE, ITEM_SUBCLASS_FOOD, KNOWN_TITLES_SIZE, LearnCustomSpells(), LearnDefaultSkills(), LOG_ERROR, m_items, m_Last_tick, WorldObject::m_name, m_Played_time, Unit::m_race, Unit::m_realRace, PlayerInfo::mapId, MAX_OUTFIT_ITEMS, CharacterCreateInfo::Name, NULL_BAG, NULL_SLOT, PlayerInfo::orientation, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, Player, PLAYER__FIELD_KNOWN_TITLES, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_FIELD_COINAGE, PLAYER_FIELD_KILLS, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_GUILD_TIMESTAMP, PLAYER_GUILDID, PLAYER_GUILDRANK, PLAYER_SLOTS_COUNT, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, POWER_MANA, POWER_RUNE, POWER_RUNIC_POWER, ChrClassesEntry::powerType, CharacterCreateInfo::Race, REALM_TYPE_PVP, REALM_TYPE_RPPVP, Position::Relocate(), RemoveItem(), REST_STATE_NOT_RAF_LINKED, REST_STATE_RAF_LINKED, sChrClassesStore, SetAmmo(), SetArenaPoints(), Object::SetByteFlag(), Object::SetByteValue(), SetFactionForRace(), Object::SetFloatValue(), Unit::SetFullHealth(), SetHonorPoints(), Object::SetInt32Value(), SetMap(), Unit::SetMaxPower(), SetObjectScale(), Unit::SetPower(), Unit::SetUInt32Value(), Object::SetUInt64Value(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), CharacterCreateInfo::Skin, sMapMgr, sObjectMgr, SPELL_CATEGORY_DRINK, SPELL_CATEGORY_FOOD, _Spell::SpellCategory, ItemTemplate::Spells, StoreItem(), StoreNewItemInBestSlots(), ItemTemplate::SubClass, sWorld, UNIT_BYTE2_FLAG_PVP, UNIT_FIELD_BYTES_0, UNIT_FIELD_BYTES_2, UNIT_FIELD_HOVERHEIGHT, UNIT_FIELD_LEVEL, UNIT_FLAG2_REGENERATE_POWER, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MOD_CAST_SPEED, UpdateAllStats(), and UpdateMaxPower().

◆ CreateCorpse()

Corpse * Player::CreateCorpse ( )
4626{
4627 // prevent existence 2 corpse for player
4629
4630 uint32 _uf, _pb, _pb2, _cfb1, _cfb2;
4631
4633 SetPvPDeath(false);
4634
4635 if (!corpse->Create(GetMap()->GenerateLowGuid<HighGuid::Corpse>(), this))
4636 {
4637 delete corpse;
4638 return nullptr;
4639 }
4640
4642
4643 _uf = getRace();
4646
4647 uint8 race = (uint8)(_uf);
4648 uint8 skin = (uint8)(_pb);
4649 uint8 face = (uint8)(_pb >> 8);
4650 uint8 hairstyle = (uint8)(_pb >> 16);
4651 uint8 haircolor = (uint8)(_pb >> 24);
4652 uint8 facialhair = (uint8)(_pb2);
4653
4654 _cfb1 = ((0x00) | (race << 8) | (GetByteValue(PLAYER_BYTES_3, 0) << 16) | (skin << 24));
4655 _cfb2 = ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24));
4656
4657 corpse->SetUInt32Value(CORPSE_FIELD_BYTES_1, _cfb1);
4658 corpse->SetUInt32Value(CORPSE_FIELD_BYTES_2, _cfb2);
4659
4660 uint32 flags = CORPSE_FLAG_UNK2;
4662 flags |= CORPSE_FLAG_HIDE_HELM;
4664 flags |= CORPSE_FLAG_HIDE_CLOAK;
4665
4666 // Xinef: Player can loop corpses while in BG or in WG
4667 if (InBattleground() && !InArena())
4668 flags |= CORPSE_FLAG_LOOTABLE;
4669 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
4670 if (Bf && Bf->IsWarTime())
4671 flags |= CORPSE_FLAG_LOOTABLE;
4672
4673 corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
4674
4676
4678
4679 uint32 iDisplayID;
4680 uint32 iIventoryType;
4681 uint32 _cfi;
4682 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; i++)
4683 {
4684 if (m_items[i])
4685 {
4686 iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID;
4687 iIventoryType = m_items[i]->GetTemplate()->InventoryType;
4688
4689 _cfi = iDisplayID | (iIventoryType << 24);
4690 corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi);
4691 }
4692 }
4693
4694 // register for player, but not show
4695 GetMap()->AddCorpse(corpse);
4696
4698
4699 // we do not need to save corpses for BG/arenas
4700 if (!GetMap()->IsBattlegroundOrArena())
4701 corpse->SaveToDB();
4702
4703 return corpse;
4704}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:77
@ BATTLEFIELD_BATTLEID_WG
Definition Battlefield.h:35
@ CORPSE_RESURRECTABLE_PVE
Definition Corpse.h:29
@ CORPSE_FLAG_HIDE_CLOAK
Definition Corpse.h:44
@ CORPSE_FLAG_UNK2
Definition Corpse.h:42
@ CORPSE_FLAG_HIDE_HELM
Definition Corpse.h:43
@ CORPSE_FLAG_LOOTABLE
Definition Corpse.h:45
@ CORPSE_FIELD_BYTES_2
Definition UpdateFields.h:425
@ CORPSE_FIELD_FLAGS
Definition UpdateFields.h:427
@ CORPSE_FIELD_BYTES_1
Definition UpdateFields.h:424
@ CORPSE_FIELD_DISPLAY_ID
Definition UpdateFields.h:422
@ CORPSE_FIELD_ITEM
Definition UpdateFields.h:423
@ CORPSE_FIELD_GUILD
Definition UpdateFields.h:426
Definition Battlefield.h:204
bool IsWarTime()
Return true if battle is start, false if battle is not started.
Definition Battlefield.h:247
void SaveToDB()
Definition Corpse.cpp:90
bool Create(ObjectGuid::LowType guidlow)
Definition Corpse.cpp:61
void AddCorpse(Corpse *corpse)
Definition Map.cpp:2565
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:639
WorldLocation _corpseLocation
Definition Player.h:3022
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4720
void SetPvPDeath(bool on)
Definition Player.h:1190
bool InArena() const
Definition Player.cpp:12266
uint32 GetNativeDisplayId() const
Definition Unit.h:1889
void WorldRelocate(const WorldLocation &loc)
Definition Position.h:263
void UpdatePositionData()
Definition Object.cpp:1119

References _corpseLocation, Map::AddCorpse(), BATTLEFIELD_BATTLEID_WG, CORPSE_FIELD_BYTES_1, CORPSE_FIELD_BYTES_2, CORPSE_FIELD_DISPLAY_ID, CORPSE_FIELD_FLAGS, CORPSE_FIELD_GUILD, CORPSE_FIELD_ITEM, CORPSE_FLAG_HIDE_CLOAK, CORPSE_FLAG_HIDE_HELM, CORPSE_FLAG_LOOTABLE, CORPSE_FLAG_UNK2, CORPSE_RESURRECTABLE_PVE, CORPSE_RESURRECTABLE_PVP, Corpse::Create(), ItemTemplate::DisplayInfoID, EQUIPMENT_SLOT_END, Object::GetByteValue(), GetGuildId(), WorldObject::GetMap(), Unit::GetNativeDisplayId(), Unit::getRace(), Item::GetTemplate(), Object::GetUInt32Value(), HasPlayerFlag(), InArena(), InBattleground(), ItemTemplate::InventoryType, Battlefield::IsWarTime(), m_ExtraFlags, m_items, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_EXTRA_PVP_DEATH, PLAYER_FLAGS_HIDE_CLOAK, PLAYER_FLAGS_HIDE_HELM, Corpse::SaveToDB(), sBattlefieldMgr, SetPvPDeath(), Object::SetUInt32Value(), SpawnCorpseBones(), WorldObject::UpdatePositionData(), and WorldLocation::WorldRelocate().

Referenced by BuildPlayerRepop().

◆ CreatePet() [1/2]

Pet * Player::CreatePet ( Creature creatureTarget,
uint32  spellID = 0 
)
9231{
9232 if (IsExistPet())
9233 {
9234 return nullptr;
9235 }
9236
9237 if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
9238 {
9239 return nullptr;
9240 }
9241
9242 CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
9243 if (!creatrueTemplate->family)
9244 {
9245 // Creatures with family 0 crashes the server
9246 return nullptr;
9247 }
9248
9249 // Everything looks OK, create new pet
9250 Pet* pet = CreateTamedPetFrom(creatureTarget, spellID);
9251 if (!pet)
9252 {
9253 return nullptr;
9254 }
9255
9256 // "kill" original creature
9257 creatureTarget->DespawnOrUnsummon();
9258
9259 // calculate proper level
9260 uint8 level = (creatureTarget->GetLevel() < (GetLevel() - 5)) ? (GetLevel() - 5) : GetLevel();
9261
9262 // prepare visual effect for levelup
9263 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
9264
9265 // add to world
9266 pet->GetMap()->AddToMap(pet->ToCreature());
9267
9268 // visual effect for levelup
9269 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
9270
9271 // caster have pet now
9272 SetMinion(pet, true);
9273
9274 pet->InitTalentForLevel();
9275
9278
9279 return pet;
9280}
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition Creature.cpp:2182
void InitTalentForLevel()
Definition Pet.cpp:2228
void SavePetToDB(PetSaveMode mode)
Definition Pet.cpp:502
bool IsExistPet()
Definition Player.cpp:9224
void PetSpellInitialize()
Definition Player.cpp:9511
void SetMinion(Minion *minion, bool apply)
Definition Unit.cpp:10771
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition Unit.cpp:17425
bool IsPet() const
Definition Unit.h:747
uint32 family
Definition CreatureData.h:217

References Map::AddToMap(), Unit::CreateTamedPetFrom(), Creature::DespawnOrUnsummon(), CreatureTemplate::family, Object::GetEntry(), Unit::GetLevel(), WorldObject::GetMap(), Pet::InitTalentForLevel(), IsExistPet(), Unit::IsPet(), Object::IsPlayer(), PET_SAVE_AS_CURRENT, PetSpellInitialize(), Pet::SavePetToDB(), Unit::SetMinion(), Unit::SetUInt32Value(), sObjectMgr, Object::ToCreature(), and UNIT_FIELD_LEVEL.

Referenced by npc_commandscript::HandleNpcTameCommand(), and pet_commandscript::HandlePetCreateCommand().

◆ CreatePet() [2/2]

Pet * Player::CreatePet ( uint32  creatureEntry,
uint32  spellID = 0 
)
9283{
9284 if (IsExistPet())
9285 {
9286 return nullptr;
9287 }
9288
9289 CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureEntry);
9290 if (!creatrueTemplate->family)
9291 {
9292 // Creatures with family 0 crashes the server
9293 return nullptr;
9294 }
9295
9296 // Everything looks OK, create new pet
9297 Pet* pet = CreateTamedPetFrom(creatureEntry, spellID);
9298 if (!pet)
9299 {
9300 return nullptr;
9301 }
9302
9303 // prepare visual effect for levelup
9305
9306 // add to world
9307 pet->GetMap()->AddToMap(pet->ToCreature());
9308
9309 // visual effect for levelup
9311
9312 // caster have pet now
9313 SetMinion(pet, true);
9314
9315 pet->InitTalentForLevel();
9316
9319
9320 return pet;
9321}

References Map::AddToMap(), Unit::CreateTamedPetFrom(), CreatureTemplate::family, Unit::GetLevel(), WorldObject::GetMap(), Pet::InitTalentForLevel(), IsExistPet(), PET_SAVE_AS_CURRENT, PetSpellInitialize(), Pet::SavePetToDB(), Unit::SetMinion(), Unit::SetUInt32Value(), sObjectMgr, Object::ToCreature(), and UNIT_FIELD_LEVEL.

◆ Customize()

void Player::Customize ( CharacterCustomizeInfo const *  customizeInfo,
CharacterDatabaseTransaction  trans 
)
static
115{
117 stmt->SetData(0, customizeInfo->Gender);
118 stmt->SetData(1, customizeInfo->Skin);
119 stmt->SetData(2, customizeInfo->Face);
120 stmt->SetData(3, customizeInfo->HairStyle);
121 stmt->SetData(4, customizeInfo->HairColor);
122 stmt->SetData(5, customizeInfo->FacialHair);
123 stmt->SetData(6, customizeInfo->Guid.GetCounter());
124
125 CharacterDatabase.ExecuteOrAppend(trans, stmt);
126}
@ CHAR_UPD_GENDER_AND_APPEARANCE
Definition CharacterDatabase.h:317

References CHAR_UPD_GENDER_AND_APPEARANCE, CharacterDatabase, CharacterCustomizeInfo::Face, CharacterCustomizeInfo::FacialHair, CharacterCustomizeInfo::Gender, ObjectGuid::GetCounter(), CharacterRenameInfo::Guid, CharacterCustomizeInfo::HairColor, CharacterCustomizeInfo::HairStyle, PreparedStatementBase::SetData(), and CharacterCustomizeInfo::Skin.

Referenced by WorldSession::HandleCharCustomizeCallback(), and WorldSession::HandleCharFactionOrRaceChangeCallback().

◆ DeleteEquipmentSet()

void Player::DeleteEquipmentSet ( uint64  setGuid)
14591{
14592 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14593 {
14594 if (itr->second.Guid == setGuid)
14595 {
14596 if (itr->second.state == EQUIPMENT_SET_NEW)
14597 m_EquipmentSets.erase(itr);
14598 else
14599 itr->second.state = EQUIPMENT_SET_DELETED;
14600 break;
14601 }
14602 }
14603}

References EQUIPMENT_SET_DELETED, EQUIPMENT_SET_NEW, and m_EquipmentSets.

Referenced by WorldSession::HandleEquipmentSetDelete().

◆ DeleteFromDB()

void Player::DeleteFromDB ( ObjectGuid::LowType  lowGuid,
uint32  accountId,
bool  updateRealmChars,
bool  deleteFinally 
)
static

Deletes a character from the database

The way, how the characters will be deleted is decided based on the config option.

Parameters
playerguidthe low-GUID from the player which should be deleted
accountIdthe account id from the player
updateRealmCharswhen this flag is set, the amount of characters on that realm will be updated in the realmlist
deleteFinallyif this flag is set, the config option will be ignored and the character will be permanently removed from the database
4001{
4002 // for not existed account avoid update realm
4003 if (!accountId)
4004 updateRealmChars = false;
4005
4006 ObjectGuid playerGuid = ObjectGuid::Create<HighGuid::Player>(lowGuid);
4007
4008 uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
4009 uint32 charDelete_minLvl = sWorld->getIntConfig(CONFIG_CHARDELETE_MIN_LEVEL);
4010
4011 // if we want to finally delete the character or the character does not meet the level requirement,
4012 // we set it to mode CHAR_DELETE_REMOVE
4013 if (deleteFinally || sCharacterCache->GetCharacterLevelByGuid(playerGuid) < charDelete_minLvl)
4014 charDelete_method = CHAR_DELETE_REMOVE;
4015
4016 if (uint32 guildId = sCharacterCache->GetCharacterGuildIdByGuid(playerGuid))
4017 if (Guild* guild = sGuildMgr->GetGuildById(guildId))
4018 guild->DeleteMember(playerGuid, false, false, true);
4019
4020 // remove from arena teams
4021 LeaveAllArenaTeams(playerGuid);
4022
4023 // close player ticket if any
4024 GmTicket* ticket = sTicketMgr->GetTicketByPlayer(playerGuid);
4025 if (ticket)
4026 sTicketMgr->CloseTicket(ticket->GetId(), playerGuid);
4027
4028 // remove from group
4029 if (ObjectGuid groupId = sCharacterCache->GetCharacterGroupGuidByGuid(playerGuid))
4030 if (Group* group = sGroupMgr->GetGroupByGUID(groupId.GetCounter()))
4031 RemoveFromGroup(group, playerGuid);
4032
4033 // Remove signs from petitions (also remove petitions if owner);
4034 RemovePetitionsAndSigns(playerGuid, 10);
4035
4036 CharacterDatabasePreparedStatement* stmt = nullptr;
4037
4038 switch (charDelete_method)
4039 {
4040 // Completely remove from the database
4041 case CHAR_DELETE_REMOVE:
4042 {
4043 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
4044
4045 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_COD_ITEM_MAIL);
4046 stmt->SetData(0, lowGuid);
4047 PreparedQueryResult resultMail = CharacterDatabase.Query(stmt);
4048
4049 if (resultMail)
4050 {
4051 std::unordered_map<uint32, std::vector<Item*>> itemsByMail;
4052
4053 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
4054 stmt->SetData(0, lowGuid);
4055 PreparedQueryResult resultItems = CharacterDatabase.Query(stmt);
4056
4057 if (resultItems)
4058 {
4059 do
4060 {
4061 Field* fields = resultItems->Fetch();
4062 uint32 mailId = fields[14].Get<uint32>();
4063 if (Item* mailItem = _LoadMailedItem(playerGuid, nullptr, mailId, nullptr, fields))
4064 {
4065 itemsByMail[mailId].push_back(mailItem);
4066 }
4067 } while (resultItems->NextRow());
4068 }
4069
4070 do
4071 {
4072 Field* mailFields = resultMail->Fetch();
4073
4074 uint32 mail_id = mailFields[0].Get<uint32>();
4075 uint8 mailType = mailFields[1].Get<uint8>();
4076 uint16 mailTemplateId = mailFields[2].Get<uint16>();
4077 uint32 sender = mailFields[3].Get<uint32>();
4078 std::string subject = mailFields[4].Get<std::string>();
4079 std::string body = mailFields[5].Get<std::string>();
4080 uint32 money = mailFields[6].Get<uint32>();
4081 bool has_items = mailFields[7].Get<bool>();
4082
4083 // We can return mail now
4084 // So firstly delete the old one
4085 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
4086 stmt->SetData(0, mail_id);
4087 trans->Append(stmt);
4088
4089 // Mail is not from player
4090 if (mailType != MAIL_NORMAL)
4091 {
4092 if (has_items)
4093 {
4094 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
4095 stmt->SetData(0, mail_id);
4096 trans->Append(stmt);
4097 }
4098 continue;
4099 }
4100
4101 MailDraft draft(subject, body);
4102 if (mailTemplateId)
4103 draft = MailDraft(mailTemplateId, false); // items are already included
4104
4105 auto itemsItr = itemsByMail.find(mail_id);
4106 if (itemsItr != itemsByMail.end())
4107 {
4108 for (Item* item : itemsItr->second)
4109 {
4110 draft.AddItem(item);
4111 }
4112
4113 // MailDraft will take care of freeing memory.
4114 itemsByMail.erase(itemsItr);
4115 }
4116
4117 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
4118 stmt->SetData(0, mail_id);
4119 trans->Append(stmt);
4120
4121 uint32 pl_account = sCharacterCache->GetCharacterAccountIdByGuid(ObjectGuid(HighGuid::Player, lowGuid));
4122
4123 draft.AddMoney(money).SendReturnToSender(pl_account, lowGuid, sender, trans);
4124 } while (resultMail->NextRow());
4125 }
4126
4127 // Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
4128 // NOW we can finally clear other DB data related to character
4129 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_IDS);
4130 stmt->SetData(0, lowGuid);
4131 PreparedQueryResult resultPets = CharacterDatabase.Query(stmt);
4132
4133 if (resultPets)
4134 {
4135 do
4136 {
4137 ObjectGuid::LowType petguidlow = (*resultPets)[0].Get<uint32>();
4138 Pet::DeleteFromDB(petguidlow);
4139 } while (resultPets->NextRow());
4140 }
4141
4142 // Delete char from social list of online chars
4143 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_SOCIAL);
4144 stmt->SetData(0, lowGuid);
4145 PreparedQueryResult resultFriends = CharacterDatabase.Query(stmt);
4146
4147 if (resultFriends)
4148 {
4149 do
4150 {
4151 if (Player* pFriend = ObjectAccessor::FindPlayerByLowGUID((*resultFriends)[0].Get<uint32>()))
4152 {
4153 pFriend->GetSocial()->RemoveFromSocialList(playerGuid, SOCIAL_FLAG_ALL);
4154 sSocialMgr->SendFriendStatus(pFriend, FRIEND_REMOVED, playerGuid, false);
4155 }
4156 } while (resultFriends->NextRow());
4157 }
4158
4159 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER);
4160 stmt->SetData(0, lowGuid);
4161 trans->Append(stmt);
4162
4163 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA);
4164 stmt->SetData(0, lowGuid);
4165 trans->Append(stmt);
4166
4167 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
4168 stmt->SetData(0, lowGuid);
4169 trans->Append(stmt);
4170
4171 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION);
4172 stmt->SetData(0, lowGuid);
4173 trans->Append(stmt);
4174
4175 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA);
4176 stmt->SetData(0, lowGuid);
4177 trans->Append(stmt);
4178
4179 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GIFT);
4180 stmt->SetData(0, lowGuid);
4181 trans->Append(stmt);
4182
4183 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND);
4184 stmt->SetData(0, lowGuid);
4185 trans->Append(stmt);
4186
4187 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE);
4188 stmt->SetData(0, lowGuid);
4189 trans->Append(stmt);
4190
4191 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY);
4192 stmt->SetData(0, lowGuid);
4193 trans->Append(stmt);
4194
4195 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
4196 stmt->SetData(0, lowGuid);
4197 trans->Append(stmt);
4198
4199 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED);
4200 stmt->SetData(0, lowGuid);
4201 trans->Append(stmt);
4202
4203 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION);
4204 stmt->SetData(0, lowGuid);
4205 trans->Append(stmt);
4206
4207 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL);
4208 stmt->SetData(0, lowGuid);
4209 trans->Append(stmt);
4210
4211 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN);
4212 stmt->SetData(0, lowGuid);
4213 trans->Append(stmt);
4214
4215 if (sWorld->getBoolConfig(CONFIG_DELETE_CHARACTER_TICKET_TRACE))
4216 {
4218 stmt->SetData(0, lowGuid);
4219 trans->Append(stmt);
4220 }
4221 else
4222 {
4223 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS);
4224 stmt->SetData(0, lowGuid);
4225 trans->Append(stmt);
4226 }
4227
4228 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER);
4229 stmt->SetData(0, lowGuid);
4230 trans->Append(stmt);
4231
4232 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
4233 stmt->SetData(0, lowGuid);
4234 trans->Append(stmt);
4235
4236 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
4237 stmt->SetData(0, lowGuid);
4238 trans->Append(stmt);
4239
4240 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL);
4241 stmt->SetData(0, lowGuid);
4242 trans->Append(stmt);
4243
4244 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS);
4245 stmt->SetData(0, lowGuid);
4246 trans->Append(stmt);
4247
4248 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER);
4249 stmt->SetData(0, lowGuid);
4250 trans->Append(stmt);
4251
4253 stmt->SetData(0, lowGuid);
4254 trans->Append(stmt);
4255
4256 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS);
4257 stmt->SetData(0, lowGuid);
4258 trans->Append(stmt);
4259
4260 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS);
4261 stmt->SetData(0, lowGuid);
4262 trans->Append(stmt);
4263
4264 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_EQUIPMENTSETS);
4265 stmt->SetData(0, lowGuid);
4266 trans->Append(stmt);
4267
4268 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER);
4269 stmt->SetData(0, lowGuid);
4270 stmt->SetData(1, lowGuid);
4271 trans->Append(stmt);
4272
4273 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER);
4274 stmt->SetData(0, lowGuid);
4275 trans->Append(stmt);
4276
4277 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ENTRY_POINT);
4278 stmt->SetData(0, lowGuid);
4279 trans->Append(stmt);
4280
4281 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS);
4282 stmt->SetData(0, lowGuid);
4283 trans->Append(stmt);
4284
4285 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY_CHAR);
4286 stmt->SetData(0, lowGuid);
4287 trans->Append(stmt);
4288
4289 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR);
4290 stmt->SetData(0, lowGuid);
4291 trans->Append(stmt);
4292
4293 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR);
4294 stmt->SetData(0, lowGuid);
4295 trans->Append(stmt);
4296
4297 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR);
4298 stmt->SetData(0, lowGuid);
4299 trans->Append(stmt);
4300
4301 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT);
4302 stmt->SetData(0, lowGuid);
4303 trans->Append(stmt);
4304
4305 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILLS);
4306 stmt->SetData(0, lowGuid);
4307 trans->Append(stmt);
4308
4309 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SETTINGS);
4310 stmt->SetData(0, lowGuid);
4311 trans->Append(stmt);
4312
4313 Corpse::DeleteFromDB(playerGuid, trans);
4314
4315 sScriptMgr->OnPlayerDeleteFromDB(trans, lowGuid);
4316
4317 CharacterDatabase.CommitTransaction(trans);
4318 break;
4319 }
4320 // The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
4321 case CHAR_DELETE_UNLINK:
4322 {
4323 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO);
4324
4325 stmt->SetData(0, lowGuid);
4326
4327 CharacterDatabase.Execute(stmt);
4328 break;
4329 }
4330 default:
4331 LOG_ERROR("entities.player", "Player::DeleteFromDB: Unsupported delete method: {}.", charDelete_method);
4332 return;
4333 }
4334
4335 if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByGuid(playerGuid))
4336 {
4337 std::string name = cache->Name;
4338 sCharacterCache->DeleteCharacterCacheEntry(playerGuid, name);
4339 }
4340
4341 if (updateRealmChars)
4342 {
4343 sWorld->UpdateRealmCharCount(accountId);
4344 }
4345}
@ CHAR_DEL_CHAR_SOCIAL_BY_FRIEND
Definition CharacterDatabase.h:395
@ CHAR_DEL_CHAR_GIFT
Definition CharacterDatabase.h:410
@ CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER
Definition CharacterDatabase.h:478
@ CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER
Definition CharacterDatabase.h:421
@ CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER
Definition CharacterDatabase.h:420
@ CHAR_DEL_CHAR_SKILLS
Definition CharacterDatabase.h:424
@ CHAR_DEL_CHAR_PET_BY_OWNER
Definition CharacterDatabase.h:477
@ CHAR_DEL_ITEM_INSTANCE_BY_OWNER
Definition CharacterDatabase.h:128
@ CHAR_DEL_CHAR_DECLINED_NAME
Definition CharacterDatabase.h:386
@ CHAR_SEL_MAILITEMS
Definition CharacterDatabase.h:101
@ CHAR_UPD_DELETE_INFO
Definition CharacterDatabase.h:294
@ CHAR_DEL_CHAR_EQUIPMENTSETS
Definition CharacterDatabase.h:419
@ CHAR_DEL_PLAYER_ACCOUNT_DATA
Definition CharacterDatabase.h:203
@ CHAR_DEL_MAIL
Definition CharacterDatabase.h:416
@ CHAR_DEL_CHAR_TALENT
Definition CharacterDatabase.h:423
@ CHAR_SEL_CHAR_SOCIAL
Definition CharacterDatabase.h:350
@ CHAR_DEL_CHAR_INVENTORY
Definition CharacterDatabase.h:412
@ CHAR_DEL_CHAR_QUESTSTATUS
Definition CharacterDatabase.h:393
@ CHAR_DEL_CHAR_ACTION
Definition CharacterDatabase.h:408
@ CHAR_SEL_CHAR_PET_IDS
Definition CharacterDatabase.h:480
@ CHAR_DEL_CHAR_ACHIEVEMENTS
Definition CharacterDatabase.h:418
@ CHAR_SEL_CHAR_COD_ITEM_MAIL
Definition CharacterDatabase.h:349
@ CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION
Definition CharacterDatabase.h:267
@ CHAR_DEL_CHAR_REPUTATION
Definition CharacterDatabase.h:414
@ CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS
Definition CharacterDatabase.h:366
@ CHAR_DEL_CHARACTER
Definition CharacterDatabase.h:407
@ CHAR_DEL_CHAR_SOCIAL_BY_GUID
Definition CharacterDatabase.h:394
@ CHAR_DEL_CHAR_SETTINGS
Definition CharacterDatabase.h:524
@ CHAR_DEL_CHAR_SPELL
Definition CharacterDatabase.h:415
@ CHAR_DEL_CHAR_QUESTSTATUS_REWARDED
Definition CharacterDatabase.h:413
@ CHAR_DEL_PLAYER_GM_TICKETS
Definition CharacterDatabase.h:266
@ CHAR_DEL_MAIL_ITEMS
Definition CharacterDatabase.h:417
@ CHAR_DEL_CHAR_INSTANCE
Definition CharacterDatabase.h:411
#define sGuildMgr
Definition GuildMgr.h:51
@ MAIL_NORMAL
Definition Mail.h:37
@ CHAR_DELETE_REMOVE
Definition Player.h:960
@ CHAR_DELETE_UNLINK
Definition Player.h:961
@ FRIEND_REMOVED
Definition SocialMgr.h:71
#define sSocialMgr
Definition SocialMgr.h:147
@ SOCIAL_FLAG_ALL
Definition SocialMgr.h:44
#define sTicketMgr
Definition TicketMgr.h:260
@ CONFIG_CHARDELETE_METHOD
Definition WorldConfig.h:309
@ CONFIG_CHARDELETE_MIN_LEVEL
Definition WorldConfig.h:310
@ CONFIG_DELETE_CHARACTER_TICKET_TRACE
Definition WorldConfig.h:94
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition Corpse.cpp:119
Definition TicketMgr.h:88
uint32 GetId() const
Definition TicketMgr.h:101
Definition Guild.h:292
void DeleteFromDB() override
Definition Pet.h:171
static void RemoveFromGroup(Group *group, ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
Definition Player.cpp:2357
static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
Definition Player.cpp:10097
static void LeaveAllArenaTeams(ObjectGuid guid)
Definition Player.cpp:10165
Player * FindPlayerByLowGUID(ObjectGuid::LowType lowguid)
Definition ObjectAccessor.cpp:251
Definition CharacterCache.h:28

References _LoadMailedItem(), MailDraft::AddItem(), MailDraft::AddMoney(), CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS, CHAR_DEL_CHAR_ACHIEVEMENTS, CHAR_DEL_CHAR_ACTION, CHAR_DEL_CHAR_AURA, CHAR_DEL_CHAR_DECLINED_NAME, CHAR_DEL_CHAR_EQUIPMENTSETS, CHAR_DEL_CHAR_GIFT, CHAR_DEL_CHAR_GLYPHS, CHAR_DEL_CHAR_INSTANCE, CHAR_DEL_CHAR_INVENTORY, CHAR_DEL_CHAR_PET_BY_OWNER, CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, CHAR_DEL_CHAR_QUESTSTATUS, CHAR_DEL_CHAR_QUESTSTATUS_REWARDED, CHAR_DEL_CHAR_REPUTATION, CHAR_DEL_CHAR_SETTINGS, CHAR_DEL_CHAR_SKILLS, CHAR_DEL_CHAR_SOCIAL_BY_FRIEND, CHAR_DEL_CHAR_SOCIAL_BY_GUID, CHAR_DEL_CHAR_SPELL, CHAR_DEL_CHAR_SPELL_COOLDOWN, CHAR_DEL_CHAR_TALENT, CHAR_DEL_CHARACTER, CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER, CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER, CHAR_DEL_ITEM_INSTANCE_BY_OWNER, CHAR_DEL_MAIL, CHAR_DEL_MAIL_BY_ID, CHAR_DEL_MAIL_ITEM_BY_ID, CHAR_DEL_MAIL_ITEMS, CHAR_DEL_PLAYER_ACCOUNT_DATA, CHAR_DEL_PLAYER_ENTRY_POINT, CHAR_DEL_PLAYER_GM_TICKETS, CHAR_DEL_PLAYER_HOMEBIND, CHAR_DEL_QUEST_STATUS_DAILY_CHAR, CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR, CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR, CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR, CHAR_DELETE_REMOVE, CHAR_DELETE_UNLINK, CHAR_SEL_CHAR_COD_ITEM_MAIL, CHAR_SEL_CHAR_PET_IDS, CHAR_SEL_CHAR_SOCIAL, CHAR_SEL_MAILITEMS, CHAR_UPD_DELETE_INFO, CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION, CharacterDatabase, CONFIG_CHARDELETE_METHOD, CONFIG_CHARDELETE_MIN_LEVEL, CONFIG_DELETE_CHARACTER_TICKET_TRACE, Pet::DeleteFromDB(), Corpse::DeleteFromDB(), ObjectAccessor::FindPlayerByLowGUID(), FRIEND_REMOVED, Field::Get(), GmTicket::GetId(), LeaveAllArenaTeams(), LOG_ERROR, MAIL_NORMAL, Player, RemoveFromGroup(), RemovePetitionsAndSigns(), sCharacterCache, MailDraft::SendReturnToSender(), PreparedStatementBase::SetData(), sGroupMgr, sGuildMgr, SOCIAL_FLAG_ALL, sScriptMgr, sSocialMgr, sTicketMgr, and sWorld.

Referenced by AccountMgr::DeleteAccount(), DeleteOldCharacters(), character_commandscript::HandleCharacterDeletedDeleteCommand(), character_commandscript::HandleCharacterEraseCommand(), and WorldSession::HandleCharDeleteOpcode().

◆ DeleteOldCharacters() [1/2]

void Player::DeleteOldCharacters ( )
static

Characters which were kept back in the database after being deleted and are now too old (see config option "CharDelete.KeepDays"), will be completely deleted.

4351{
4352 uint32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
4353 if (!keepDays)
4354 return;
4355
4357}
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition WorldConfig.h:308
static void DeleteOldCharacters()
Definition Player.cpp:4350

References CONFIG_CHARDELETE_KEEP_DAYS, DeleteOldCharacters(), and sWorld.

Referenced by DeleteOldCharacters(), character_commandscript::HandleCharacterDeletedPurgeCommand(), and World::SetInitialWorldSettings().

◆ DeleteOldCharacters() [2/2]

void Player::DeleteOldCharacters ( uint32  keepDays)
static

Characters which were kept back in the database after being deleted and are older than the specified amount of days, will be completely deleted.

4363{
4364 LOG_INFO("server.loading", "Player::DeleteOldChars: Deleting all characters which have been deleted {} days before...", keepDays);
4365 LOG_INFO("server.loading", " ");
4366
4368 stmt->SetData(0, uint32(GameTime::GetGameTime().count() - time_t(keepDays * DAY)));
4369 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4370
4371 if (result)
4372 {
4373 LOG_INFO("server.loading", "Player::DeleteOldChars: Found {} character(s) to delete", result->GetRowCount());
4374 do
4375 {
4376 Field* fields = result->Fetch();
4377 Player::DeleteFromDB(fields[0].Get<uint32>(), fields[1].Get<uint32>(), true, true);
4378 } while (result->NextRow());
4379 }
4380}
@ CHAR_SEL_CHAR_OLD_CHARS
Definition CharacterDatabase.h:351
constexpr auto DAY
Definition Common.h:49
static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
Definition Player.cpp:4000

References CHAR_SEL_CHAR_OLD_CHARS, CharacterDatabase, DAY, DeleteFromDB(), GameTime::GetGameTime(), LOG_INFO, and PreparedStatementBase::SetData().

◆ DeleteOldRecoveryItems() [1/2]

void Player::DeleteOldRecoveryItems ( )
static

Items which were kept back in the database after being deleted and are now too old (see config option "ItemDelete.KeepDays"), will be completely deleted.

4386{
4387 uint32 keepDays = sWorld->getIntConfig(CONFIG_ITEMDELETE_KEEP_DAYS);
4388 if (!keepDays)
4389 return;
4390
4392}
@ CONFIG_ITEMDELETE_KEEP_DAYS
Definition WorldConfig.h:343
static void DeleteOldRecoveryItems()
Definition Player.cpp:4385

References CONFIG_ITEMDELETE_KEEP_DAYS, DeleteOldRecoveryItems(), and sWorld.

Referenced by DeleteOldRecoveryItems(), and World::SetInitialWorldSettings().

◆ DeleteOldRecoveryItems() [2/2]

void Player::DeleteOldRecoveryItems ( uint32  keepDays)
static

Items which were kept back in the database after being deleted and are older than the specified amount of days, will be completely deleted.

4398{
4399 LOG_INFO("server.loading", "Player::DeleteOldRecoveryItems: Deleting all items which have been deleted {} days before...", keepDays);
4400 LOG_INFO("server.loading", " ");
4401
4403 stmt->SetData(0, uint32(GameTime::GetGameTime().count() - time_t(keepDays * DAY)));
4404 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4405
4406 if (result)
4407 {
4408 LOG_INFO("server.loading", "Player::DeleteOldRecoveryItems: Found {} item(s) to delete", result->GetRowCount());
4409 do
4410 {
4411 Field* fields = result->Fetch();
4412
4413 uint32 guid = fields[0].Get<uint32>();
4414 uint32 itemEntry = fields[1].Get<uint32>();
4415
4417 deleteStmt->SetData(0, guid);
4418 CharacterDatabase.Execute(deleteStmt);
4419
4420 LOG_INFO("server.loading", "Deleted item from recovery_item table where guid {} and item id {}", guid, itemEntry);
4421 } while (result->NextRow());
4422 }
4423}
@ CHAR_SEL_RECOVERY_ITEM_OLD_ITEMS
Definition CharacterDatabase.h:513
@ CHAR_DEL_RECOVERY_ITEM_BY_GUID
Definition CharacterDatabase.h:514

References CHAR_DEL_RECOVERY_ITEM_BY_GUID, CHAR_SEL_RECOVERY_ITEM_OLD_ITEMS, CharacterDatabase, DAY, Field::Get(), GameTime::GetGameTime(), LOG_INFO, and PreparedStatementBase::SetData().

◆ DeleteRefundReference()

void Player::DeleteRefundReference ( ObjectGuid  itemGUID)
15481{
15482 RefundableItemsSet::iterator itr = m_refundableItems.find(itemGUID);
15483 if (itr != m_refundableItems.end())
15484 m_refundableItems.erase(itr);
15485}

References m_refundableItems.

Referenced by _SaveInventory(), Item::SetNotRefundable(), and Item::SetState().

◆ DestroyConjuredItems()

void Player::DestroyConjuredItems ( bool  update)
3343{
3344 // used when entering arena
3345 // destroys all conjured items
3346 LOG_DEBUG("entities.player.items", "STORAGE: DestroyConjuredItems");
3347
3348 // in inventory
3350 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3351 if (pItem->IsConjuredConsumable())
3353
3354 // in inventory bags
3356 if (Bag* pBag = GetBagByPos(i))
3357 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
3358 if (Item* pItem = pBag->GetItemByPos(j))
3359 if (pItem->IsConjuredConsumable())
3360 DestroyItem(i, j, update);
3361
3362 // in equipment and bag list
3364 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3365 if (pItem->IsConjuredConsumable())
3367}

References DestroyItem(), EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and LOG_DEBUG.

Referenced by Battleground::AddPlayer().

◆ DestroyForPlayer()

void Player::DestroyForPlayer ( Player target,
bool  onDeath = false 
) const
overridevirtual

Reimplemented from Object.

3874{
3875 Unit::DestroyForPlayer(target, onDeath);
3876
3877 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) // xinef: previously INVENTORY_SLOT_BAG_END
3878 {
3879 if (!m_items[i])
3880 continue;
3881
3882 m_items[i]->DestroyForPlayer(target);
3883 }
3884
3885 if (target == this)
3886 {
3888 {
3889 if (!m_items[i])
3890 continue;
3891
3892 m_items[i]->DestroyForPlayer(target);
3893 }
3895 {
3896 if (!m_items[i])
3897 continue;
3898
3899 m_items[i]->DestroyForPlayer(target);
3900 }
3901 }
3902}

References BANK_SLOT_BAG_END, CURRENCYTOKEN_SLOT_END, Object::DestroyForPlayer(), EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_START, KEYRING_SLOT_START, and m_items.

◆ DestroyItem()

void Player::DestroyItem ( uint8  bag,
uint8  slot,
bool  update 
)
3024{
3025 Item* pItem = GetItemByPos(bag, slot);
3026 if (pItem)
3027 {
3028 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItem bag = {}, slot = {}, item = {}", bag, slot, pItem->GetEntry());
3029 // Also remove all contained items if the item is a bag.
3030 // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow.
3031 if (pItem->IsNotEmptyBag())
3032 for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
3033 DestroyItem(slot, i, update);
3034
3035 if (pItem->IsWrapped())
3036 {
3038 stmt->SetData(0, pItem->GetGUID().GetCounter());
3039 CharacterDatabase.Execute(stmt);
3040 }
3041
3043 RemoveItemDurations(pItem);
3044
3045 pItem->SetNotRefundable(this);
3046 pItem->ClearSoulboundTradeable(this);
3047 RemoveTradeableItem(pItem);
3048
3049 ItemTemplate const* proto = pItem->GetTemplate();
3050 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
3051 if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
3053
3054 ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
3055
3056 sScriptMgr->OnItemRemove(this, pItem);
3057
3058 if (bag == INVENTORY_SLOT_BAG_0)
3059 {
3061
3062 // equipment and equipped bags can have applied bonuses
3063 if (slot < INVENTORY_SLOT_BAG_END)
3064 {
3065 ItemTemplate const* pProto = pItem->GetTemplate();
3066
3067 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
3068 if (pProto && pProto->ItemSet)
3069 RemoveItemsSetItem(this, pProto);
3070
3071 _ApplyItemMods(pItem, slot, false);
3072 }
3073
3074 if (slot < EQUIPMENT_SLOT_END)
3075 {
3076 // remove item dependent auras and casts (only weapon and armor slots)
3078
3079 // update expertise and armor penetration - passive auras may need it
3080 switch (slot)
3081 {
3086 default:
3087 break;
3088 }
3089
3090 if (slot == EQUIPMENT_SLOT_MAINHAND)
3092 else if (slot == EQUIPMENT_SLOT_OFFHAND)
3094
3095 // equipment visual show
3096 SetVisibleItemSlot(slot, nullptr);
3097 }
3098
3099 m_items[slot] = nullptr;
3100 }
3101 else if (Bag* pBag = GetBagByPos(bag))
3102 pBag->RemoveItem(slot, update);
3103
3104 // Xinef: item is removed, remove loot from storage if any
3105 if (proto->HasFlag(ITEM_FLAG_HAS_LOOT))
3106 sLootItemStorage->RemoveStoredLoot(pItem->GetGUID());
3107
3108 if (IsInWorld() && update)
3109 {
3110 pItem->RemoveFromWorld();
3111 pItem->DestroyForPlayer(this);
3112 }
3113
3114 //pItem->SetOwnerGUID(0);
3116 pItem->SetSlot(NULL_SLOT);
3117 pItem->SetState(ITEM_REMOVED, this);
3118 }
3119}
@ CHAR_DEL_GIFT
Definition CharacterDatabase.h:130
@ ITEM_SPELLTRIGGER_ON_NO_DELAY_USE
Definition ItemTemplate.h:87
bool IsWrapped() const
Definition Item.h:263
void ItemRemovedQuestCheck(uint32 entry, uint32 count)
Definition PlayerQuest.cpp:1874
void RemoveItemDependentAurasAndCasts(Item *pItem)
Definition Player.cpp:12549
void RecalculateRating(CombatRating cr)
Definition Player.h:1977
void UpdateExpertise(WeaponAttackType attType)
Definition StatSystem.cpp:894
void SetVisibleItemSlot(uint8 slot, Item *pItem)
Definition PlayerStorage.cpp:2858

References _ApplyItemMods(), BASE_ATTACK, CHAR_DEL_GIFT, CharacterDatabase, Item::ClearSoulboundTradeable(), CR_ARMOR_PENETRATION, Object::DestroyForPlayer(), DestroyItem(), ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetBagByPos(), Item::GetCount(), ObjectGuid::GetCounter(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), Item::GetTemplate(), ItemTemplate::HasFlag(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, Object::IsInWorld(), Item::IsNotEmptyBag(), Item::IsWrapped(), ITEM_FIELD_CONTAINED, ITEM_FLAG_HAS_LOOT, ITEM_REMOVED, ITEM_SPELLTRIGGER_ON_NO_DELAY_USE, ItemRemovedQuestCheck(), ItemTemplate::ItemSet, LOG_DEBUG, m_items, MAX_BAG_SIZE, MAX_ITEM_PROTO_SPELLS, NULL_SLOT, OFF_ATTACK, PLAYER_FIELD_INV_SLOT_HEAD, RecalculateRating(), Unit::RemoveAurasDueToSpell(), RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDependentAurasAndCasts(), RemoveItemDurations(), RemoveItemsSetItem(), RemoveTradeableItem(), PreparedStatementBase::SetData(), Object::SetGuidValue(), Item::SetNotRefundable(), Item::SetSlot(), Item::SetState(), SetVisibleItemSlot(), sLootItemStorage, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, and UpdateExpertise().

Referenced by AddQuestAndCheckCompletion(), DestroyConjuredItems(), DestroyItem(), DestroyItemCount(), DestroyItemCount(), DestroyZoneLimitedItem(), WorldSession::DoLootRelease(), Spell::EffectSummonChangeItem(), bg_commandscript::HandleBagsClearCommand(), debug_commandscript::HandleDebugItemExpireCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleSocketOpcode(), WorldSession::HandleTurnInPetitionOpcode(), RefundItem(), reset_commandscript::ResetItemsDeleteBankBags(), reset_commandscript::ResetItemsDeleteStandardBags(), reset_commandscript::ResetItemsEquipped(), reset_commandscript::ResetItemsInBags(), reset_commandscript::ResetItemsInBank(), reset_commandscript::ResetItemsInCurrenciesList(), reset_commandscript::ResetItemsInKeyring(), and Item::UpdateDuration().

◆ DestroyItemCount() [1/2]

void Player::DestroyItemCount ( Item item,
uint32 count,
bool  update 
)
3398{
3399 if (!pItem)
3400 return;
3401
3402 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item ({}, Entry: {}) count = {}", pItem->GetGUID().ToString(), pItem->GetEntry(), count);
3403
3404 if (pItem->GetCount() <= count)
3405 {
3406 count -= pItem->GetCount();
3407
3408 DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), update);
3409 }
3410 else
3411 {
3412 ItemRemovedQuestCheck(pItem->GetEntry(), count);
3413 pItem->SetCount(pItem->GetCount() - count);
3414 count = 0;
3415 if (IsInWorld() && update)
3416 pItem->SendUpdateToPlayer(this);
3417 pItem->SetState(ITEM_CHANGED, this);
3418 }
3419}

References DestroyItem(), Item::GetBagSlot(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Item::GetSlot(), Object::IsInWorld(), ITEM_CHANGED, ItemRemovedQuestCheck(), LOG_DEBUG, Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), and ObjectGuid::ToString().

◆ DestroyItemCount() [2/2]

void Player::DestroyItemCount ( uint32  item,
uint32  count,
bool  update,
bool  unequip_check = false 
)
3122{
3123 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item = {}, count = {}", itemEntry, count);
3124 uint32 remcount = 0;
3125
3126 // in inventory
3128 {
3129 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3130 {
3131 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3132 {
3133 if (item->GetCount() + remcount <= count)
3134 {
3135 // all items in inventory can unequipped
3136 remcount += item->GetCount();
3138
3139 if (remcount >= count)
3140 return;
3141 }
3142 else
3143 {
3144 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3145 item->SetCount(item->GetCount() - count + remcount);
3146 if (IsInWorld() && update)
3147 item->SendUpdateToPlayer(this);
3148 item->SetState(ITEM_CHANGED, this);
3149 return;
3150 }
3151 }
3152 }
3153 }
3154
3156 {
3157 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3158 {
3159 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3160 {
3161 if (item->GetCount() + remcount <= count)
3162 {
3163 // all keys can be unequipped
3164 remcount += item->GetCount();
3166
3167 if (remcount >= count)
3168 return;
3169 }
3170 else
3171 {
3172 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3173 item->SetCount(item->GetCount() - count + remcount);
3174 if (IsInWorld() && update)
3175 item->SendUpdateToPlayer(this);
3176 item->SetState(ITEM_CHANGED, this);
3177 return;
3178 }
3179 }
3180 }
3181 }
3182
3183 // in inventory bags
3185 {
3186 if (Bag* bag = GetBagByPos(i))
3187 {
3188 for (uint32 j = 0; j < bag->GetBagSize(); j++)
3189 {
3190 if (Item* item = bag->GetItemByPos(j))
3191 {
3192 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3193 {
3194 // all items in bags can be unequipped
3195 if (item->GetCount() + remcount <= count)
3196 {
3197 remcount += item->GetCount();
3198 DestroyItem(i, j, update);
3199
3200 if (remcount >= count)
3201 return;
3202 }
3203 else
3204 {
3205 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3206 item->SetCount(item->GetCount() - count + remcount);
3207 if (IsInWorld() && update)
3208 item->SendUpdateToPlayer(this);
3209 item->SetState(ITEM_CHANGED, this);
3210 return;
3211 }
3212 }
3213 }
3214 }
3215 }
3216 }
3217
3218 // in equipment and bag list
3220 {
3221 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3222 {
3223 if (item && item->GetEntry() == itemEntry && !item->IsInTrade())
3224 {
3225 if (item->GetCount() + remcount <= count)
3226 {
3227 if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK)
3228 {
3229 remcount += item->GetCount();
3231
3232 if (remcount >= count)
3233 return;
3234 }
3235 }
3236 else
3237 {
3238 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3239 item->SetCount(item->GetCount() - count + remcount);
3240 if (IsInWorld() && update)
3241 item->SendUpdateToPlayer(this);
3242 item->SetState(ITEM_CHANGED, this);
3243 return;
3244 }
3245 }
3246 }
3247 }
3248
3249 // in bank
3251 {
3252 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3253 {
3254 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3255 {
3256 if (item->GetCount() + remcount <= count)
3257 {
3258 remcount += item->GetCount();
3260 if (remcount >= count)
3261 return;
3262 }
3263 else
3264 {
3265 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3266 item->SetCount(item->GetCount() - count + remcount);
3267 if (IsInWorld() && update)
3268 item->SendUpdateToPlayer(this);
3269 item->SetState(ITEM_CHANGED, this);
3270 return;
3271 }
3272 }
3273 }
3274 }
3275
3276 // in bank bags
3277 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
3278 {
3279 if (Bag* bag = GetBagByPos(i))
3280 {
3281 for (uint32 j = 0; j < bag->GetBagSize(); j++)
3282 {
3283 if (Item* item = bag->GetItemByPos(j))
3284 {
3285 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3286 {
3287 // all items in bags can be unequipped
3288 if (item->GetCount() + remcount <= count)
3289 {
3290 remcount += item->GetCount();
3291 DestroyItem(i, j, update);
3292
3293 if (remcount >= count)
3294 return;
3295 }
3296 else
3297 {
3298 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3299 item->SetCount(item->GetCount() - count + remcount);
3300 if (IsInWorld() && update)
3301 item->SendUpdateToPlayer(this);
3302 item->SetState(ITEM_CHANGED, this);
3303 return;
3304 }
3305 }
3306 }
3307 }
3308 }
3309 }
3310}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CanUnequipItem(), CURRENCYTOKEN_SLOT_END, DestroyItem(), EQUIP_ERR_OK, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Object::IsInWorld(), ITEM_CHANGED, ItemRemovedQuestCheck(), KEYRING_SLOT_START, and LOG_DEBUG.

Referenced by _StoreOrEquipNewItem(), AbandonQuest(), WorldSession::DoLootRelease(), Spell::EffectCreateItem2(), Spell::EffectEnchantItemPerm(), Spell::EffectFeedPet(), Spell::EffectScriptEffect(), FailQuest(), go_ahune_ice_stone::GossipSelect(), misc_commandscript::HandleAddItemCommand(), spell_brewfest_fill_keg::HandleAfterHit(), spell_brewfest_unfill_keg::HandleAfterHit(), WorldSession::HandleDestroyItemOpcode(), spell_item_massive_seaforium_charge::HandleItemRemove(), WorldSession::HandleWrapItemOpcode(), npc_brewfest_keg_reciver::MoveInLineOfSight(), at_hor_battered_hilt_throw::OnTrigger(), npc_oculus_drakegiver::RemoveEssence(), spell_najentus_remove_spines::RemoveSpines(), RewardQuest(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), npc_cultist_engineer::sGossipSelect(), Spell::TakeAmmo(), Spell::TakeCastItem(), TakeQuestSourceItem(), and Spell::TakeReagents().

◆ DestroyZoneLimitedItem()

void Player::DestroyZoneLimitedItem ( bool  update,
uint32  new_zone 
)
3313{
3314 LOG_DEBUG("entities.player.items", "STORAGE: DestroyZoneLimitedItem in map {} and area {}", GetMapId(), new_zone);
3315
3316 // in inventory
3318 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3319 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3321
3323 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3324 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3326
3327 // in inventory bags
3329 if (Bag* pBag = GetBagByPos(i))
3330 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
3331 if (Item* pItem = pBag->GetItemByPos(j))
3332 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3333 DestroyItem(i, j, update);
3334
3335 // in equipment and bag list
3337 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3338 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3340}

References CURRENCYTOKEN_SLOT_END, DestroyItem(), EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), WorldLocation::GetMapId(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_START, and LOG_DEBUG.

Referenced by UpdateZone().

◆ DoRandomRoll()

uint32 Player::DoRandomRoll ( uint32  minimum,
uint32  maximum 
)
16145{
16146 ASSERT(minimum <= maximum);
16147
16148 uint32 roll = urand(minimum, maximum);
16149
16151 randomRoll.Min = minimum;
16152 randomRoll.Max = maximum;
16153 randomRoll.Result = roll;
16154 randomRoll.Roller = GetGUID();
16155 if (Group* group = GetGroup())
16156 group->BroadcastPacket(randomRoll.Write(), false);
16157 else
16158 SendDirectMessage(randomRoll.Write());
16159
16160 return roll;
16161}
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
Definition MiscPackets.h:108
uint32 Max
Definition MiscPackets.h:115
uint32 Result
Definition MiscPackets.h:116
WorldPacket const * Write() override
Definition MiscPackets.cpp:76
uint32 Min
Definition MiscPackets.h:114
ObjectGuid Roller
Definition MiscPackets.h:117

References ASSERT, GetGroup(), Object::GetGUID(), WorldPackets::Misc::RandomRoll::Max, WorldPackets::Misc::RandomRoll::Min, WorldPackets::Misc::RandomRoll::Result, WorldPackets::Misc::RandomRoll::Roller, SendDirectMessage(), urand(), and WorldPackets::Misc::RandomRoll::Write().

Referenced by WorldSession::HandleRandomRollOpcode(), and spell_item_worn_troll_dice::HandleScript().

◆ DropModCharge()

void Player::DropModCharge ( SpellModifier mod,
Spell spell 
)
10056{
10057 if (spell && mod->ownerAura && mod->charges > 0)
10058 {
10059 if (--mod->charges == 0)
10060 mod->charges = -1;
10061
10062 spell->m_appliedMods.insert(mod->ownerAura);
10063 }
10064}
UsedSpellMods m_appliedMods
Definition Spell.h:548
int16 charges
Definition Player.h:185

References SpellModifier::charges, Spell::m_appliedMods, and SpellModifier::ownerAura.

Referenced by ApplySpellMod().

◆ DuelComplete()

void Player::DuelComplete ( DuelCompleteType  type)
6444{
6445 // duel not requested
6446 if (!duel)
6447 return;
6448
6449 // Check if DuelComplete() has been called already up in the stack and in that case don't do anything else here
6450 if (duel->State == DUEL_STATE_COMPLETED)
6451 return;
6452
6453 Player* opponent = duel->Opponent;
6454 duel->State = DUEL_STATE_COMPLETED;
6455 opponent->duel->State = DUEL_STATE_COMPLETED;
6456
6457 LOG_DEBUG("entities.unit", "Player::DuelComplete: Player '{}' ({}), Opponent: '{}' ({})", GetName(), GetGUID().ToString(), opponent->GetName(), opponent->GetGUID().ToString());
6458
6460 data << uint8((type != DUEL_INTERRUPTED) ? 1 : 0);
6461 SendDirectMessage(&data);
6462 if (opponent->GetSession())
6463 {
6464 opponent->SendDirectMessage(&data);
6465 }
6466
6467 if (type != DUEL_INTERRUPTED)
6468 {
6469 data.Initialize(SMSG_DUEL_WINNER, (1 + 20)); // we guess size
6470 data << uint8(type == DUEL_WON ? 0 : 1); // 0 = just won; 1 = fled
6471 data << opponent->GetName();
6472 data << GetName();
6473 SendMessageToSet(&data, true);
6474 }
6475
6476 sScriptMgr->OnPlayerDuelEnd(opponent, this, type);
6477
6478 switch (type)
6479 {
6480 case DUEL_FLED:
6481 // if initiator and opponent are on the same team
6482 // or initiator and opponent are not PvP enabled, forcibly stop attacking
6483 if (GetTeamId() == opponent->GetTeamId())
6484 {
6485 AttackStop();
6486 opponent->AttackStop();
6487 }
6488 else
6489 {
6490 if (!IsPvP())
6491 {
6492 AttackStop();
6493 }
6494 if (!opponent->IsPvP())
6495 {
6496 opponent->AttackStop();
6497 }
6498 }
6499 break;
6500 case DUEL_WON:
6503
6504 // Credit for quest Death's Challenge
6506 {
6507 opponent->CastSpell(opponent, 52994, true);
6508 }
6509
6510 // Honor points after duel (the winner) - ImpConfig
6511 if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL))
6512 {
6513 opponent->RewardHonor(nullptr, 1, amount);
6514 }
6515
6516 break;
6517 default:
6518 break;
6519 }
6520
6521 // Victory emote spell
6522 if (type != DUEL_INTERRUPTED)
6523 {
6524 opponent->CastSpell(opponent, 52852, true);
6525 }
6526
6527 // Remove Duel Flag object
6529 if (obj)
6530 {
6531 duel->Initiator->RemoveGameObject(obj, true);
6532 }
6533
6534 /* remove auras */
6535 AuraApplicationMap& itsAuras = opponent->GetAppliedAuras();
6536 for (AuraApplicationMap::iterator i = itsAuras.begin(); i != itsAuras.end();)
6537 {
6538 Aura const* aura = i->second->GetBase();
6539 if (!i->second->IsPositive() && aura->GetCasterGUID() == GetGUID() && aura->GetApplyTime() >= duel->StartTime)
6540 {
6541 opponent->RemoveAura(i);
6542 }
6543 else
6544 {
6545 ++i;
6546 }
6547 }
6548
6550 for (AuraApplicationMap::iterator i = myAuras.begin(); i != myAuras.end();)
6551 {
6552 Aura const* aura = i->second->GetBase();
6553 if (!i->second->IsPositive() && aura->GetCasterGUID() == opponent->GetGUID() && aura->GetApplyTime() >= duel->StartTime)
6554 RemoveAura(i);
6555 else
6556 ++i;
6557 }
6558
6559 // cleanup combo points
6560 if (GetComboTarget() == duel->Opponent)
6561 {
6563 }
6564 else if (GetComboTargetGUID() == duel->Opponent->GetPetGUID())
6565 {
6567 }
6568
6569 if (duel->Opponent->GetComboTarget() == this)
6570 {
6571 duel->Opponent->ClearComboPoints();
6572 }
6573 else if (duel->Opponent->GetComboTargetGUID() == GetPetGUID())
6574 {
6575 duel->Opponent->ClearComboPoints();
6576 }
6577
6578 //cleanups
6582 opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0);
6583
6584 opponent->duel.reset(nullptr);
6585 duel.reset(nullptr);
6586}
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL
Definition DBCEnums.h:186
@ ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL
Definition DBCEnums.h:187
@ DUEL_STATE_COMPLETED
Definition Player.h:379
@ DUEL_WON
Definition SharedDefines.h:3868
@ CLASS_CONTEXT_QUEST
Definition UnitDefines.h:229
@ PLAYER_DUEL_TEAM
Definition UpdateFields.h:184
@ CONFIG_HONOR_AFTER_DUEL
Definition WorldConfig.h:290
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
time_t GetApplyTime() const
Definition SpellAuras.h:128
bool RewardHonor(Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
Definition Player.cpp:6097
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.cpp:5702
bool IsPvP()
Definition Player.cpp:16196
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:629
void ClearComboPoints()
Definition Unit.cpp:16938
Unit * GetComboTarget() const
Definition Unit.h:955
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10489
ObjectGuid const GetComboTargetGUID() const
Definition Unit.h:956
ObjectGuid GetPetGUID() const
Definition Unit.h:678
@ SMSG_DUEL_WINNER
Definition Opcodes.h:393
@ SMSG_DUEL_COMPLETE
Definition Opcodes.h:392

References ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL, ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, Unit::AttackStop(), Unit::CastSpell(), CLASS_CONTEXT_QUEST, CLASS_DEATH_KNIGHT, Unit::ClearComboPoints(), CONFIG_HONOR_AFTER_DUEL, duel, DUEL_FLED, DUEL_INTERRUPTED, DUEL_STATE_COMPLETED, DUEL_WON, ObjectGuid::Empty, Unit::GetAppliedAuras(), Aura::GetApplyTime(), Aura::GetCasterGUID(), Unit::GetComboTarget(), Unit::GetComboTargetGUID(), Map::GetGameObject(), Object::GetGUID(), Object::GetGUID(), Object::GetGuidValue(), WorldObject::GetMap(), WorldObject::GetName(), Unit::GetPetGUID(), GetQuestStatus(), GetSession(), GetTeamId(), WorldPacket::Initialize(), IsClass(), IsPvP(), LOG_DEBUG, PLAYER_DUEL_ARBITER, PLAYER_DUEL_TEAM, QUEST_STATUS_INCOMPLETE, Unit::RemoveAura(), RewardHonor(), SendDirectMessage(), SendMessageToSet(), Object::SetGuidValue(), Unit::SetUInt32Value(), SMSG_DUEL_COMPLETE, SMSG_DUEL_WINNER, sScriptMgr, sWorld, ObjectGuid::ToString(), Position::ToString(), and UpdateAchievementCriteria().

Referenced by Unit::_ExitVehicle(), CheckDuelDistance(), CleanupsBeforeDelete(), Unit::DealDamage(), WorldSession::HandleDuelCancelledOpcode(), and TeleportTo().

◆ DurabilityLoss()

void Player::DurabilityLoss ( Item item,
double  percent 
)
4777{
4778 if (!item || percent == 0.0)
4779 return;
4780
4781 uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4782
4783 if (!pMaxDurability)
4784 return;
4785
4786 uint32 pDurabilityLoss = uint32(pMaxDurability * percent);
4787
4788 if (pDurabilityLoss < 1)
4789 pDurabilityLoss = 1;
4790
4791 DurabilityPointsLoss(item, pDurabilityLoss);
4792}
@ ITEM_FIELD_MAXDURABILITY
Definition UpdateFields.h:70
void DurabilityPointsLoss(Item *item, int32 points)
Definition Player.cpp:4820

References DurabilityPointsLoss(), Object::GetUInt32Value(), and ITEM_FIELD_MAXDURABILITY.

Referenced by DurabilityLossAll(), Spell::EffectDurabilityDamagePCT(), and Spell::EffectSummonChangeItem().

◆ DurabilityLossAll()

void Player::DurabilityLossAll ( double  percent,
bool  inventory 
)
4751{
4753 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4754 DurabilityLoss(pItem, percent);
4755
4756 if (inventory)
4757 {
4758 // bags not have durability
4759 // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
4760
4762 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4763 DurabilityLoss(pItem, percent);
4764
4765 // keys not have durability
4766 //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
4767
4769 if (Bag* pBag = GetBagByPos(i))
4770 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4771 if (Item* pItem = GetItemByPos(i, j))
4772 DurabilityLoss(pItem, percent);
4773 }
4774}
void DurabilityLoss(Item *item, double percent)
Definition Player.cpp:4776

References DurabilityLoss(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::EffectDurabilityDamagePCT(), EnvironmentalDamage(), and WorldSession::SendSpiritResurrect().

◆ DurabilityPointLossForEquipSlot()

void Player::DurabilityPointLossForEquipSlot ( EquipmentSlots  slot)
4851{
4852 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
4853 DurabilityPointsLoss(pItem, 1);
4854}

References DurabilityPointsLoss(), GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by Unit::DealDamage(), and Spell::TakeAmmo().

◆ DurabilityPointsLoss()

void Player::DurabilityPointsLoss ( Item item,
int32  points 
)
4821{
4823 return;
4824
4825 int32 pMaxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4826 int32 pOldDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
4827 int32 pNewDurability = pOldDurability - points;
4828
4829 if (pNewDurability < 0)
4830 pNewDurability = 0;
4831 else if (pNewDurability > pMaxDurability)
4832 pNewDurability = pMaxDurability;
4833
4834 if (pOldDurability != pNewDurability)
4835 {
4836 // modify item stats _before_ Durability set to 0 to pass _ApplyItemMods internal check
4837 if (pNewDurability == 0 && pOldDurability > 0 && item->IsEquipped())
4838 _ApplyItemMods(item, item->GetSlot(), false);
4839
4840 item->SetUInt32Value(ITEM_FIELD_DURABILITY, pNewDurability);
4841
4842 // modify item stats _after_ restore durability to pass _ApplyItemMods internal check
4843 if (pNewDurability > 0 && pOldDurability == 0 && item->IsEquipped())
4844 _ApplyItemMods(item, item->GetSlot(), true);
4845
4846 item->SetState(ITEM_CHANGED, this);
4847 }
4848}
@ ITEM_FIELD_DURABILITY
Definition UpdateFields.h:69
bool HasPreventDurabilityLossAura() const
Definition Unit.h:1720

References _ApplyItemMods(), Item::GetSlot(), Object::GetUInt32Value(), Unit::HasPreventDurabilityLossAura(), Item::IsEquipped(), ITEM_CHANGED, ITEM_FIELD_DURABILITY, ITEM_FIELD_MAXDURABILITY, Item::SetState(), and Object::SetUInt32Value().

Referenced by DurabilityLoss(), DurabilityPointLossForEquipSlot(), DurabilityPointsLossAll(), and Spell::EffectDurabilityDamage().

◆ DurabilityPointsLossAll()

void Player::DurabilityPointsLossAll ( int32  points,
bool  inventory 
)
4795{
4797 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4798 DurabilityPointsLoss(pItem, points);
4799
4800 if (inventory)
4801 {
4802 // bags not have durability
4803 // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
4804
4806 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4807 DurabilityPointsLoss(pItem, points);
4808
4809 // keys not have durability
4810 //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
4811
4813 if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4814 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4815 if (Item* pItem = GetItemByPos(i, j))
4816 DurabilityPointsLoss(pItem, points);
4817 }
4818}

References DurabilityPointsLoss(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::EffectDurabilityDamage().

◆ DurabilityRepair()

uint32 Player::DurabilityRepair ( uint16  pos,
bool  cost,
float  discountMod,
bool  guildBank 
)
4873{
4874 Item* item = GetItemByPos(pos);
4875
4876 uint32 TotalCost = 0;
4877 if (!item)
4878 return TotalCost;
4879
4880 uint32 maxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4881 if (!maxDurability)
4882 return TotalCost;
4883
4884 uint32 curDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
4885
4886 if (cost)
4887 {
4888 uint32 LostDurability = maxDurability - curDurability;
4889 if (LostDurability > 0)
4890 {
4891 ItemTemplate const* ditemProto = item->GetTemplate();
4892
4893 DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
4894 if (!dcost)
4895 {
4896 LOG_ERROR("entities.player", "RepairDurability: Wrong item lvl {}", ditemProto->ItemLevel);
4897 return TotalCost;
4898 }
4899
4900 uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2;
4901 DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
4902 if (!dQualitymodEntry)
4903 {
4904 LOG_ERROR("entities.player", "RepairDurability: Wrong dQualityModEntry {}", dQualitymodEntryId);
4905 return TotalCost;
4906 }
4907
4908 uint32 dmultiplier = dcost->multiplier[ItemSubClassToDurabilityMultiplierId(ditemProto->Class, ditemProto->SubClass)];
4909 uint32 costs = uint32(LostDurability * dmultiplier * double(dQualitymodEntry->quality_mod));
4910
4911 costs = uint32(costs * discountMod * sWorld->getRate(RATE_REPAIRCOST));
4912
4913 if (costs == 0) //fix for ITEM_QUALITY_ARTIFACT
4914 costs = 1;
4915
4916 if (guildBank)
4917 {
4918 if (GetGuildId() == 0)
4919 {
4920 // LOG_DEBUG("entities.player", "You are not member of a guild");
4921 return TotalCost;
4922 }
4923
4924 Guild* guild = sGuildMgr->GetGuildById(GetGuildId());
4925 if (!guild)
4926 return TotalCost;
4927
4928 if (!guild->HandleMemberWithdrawMoney(GetSession(), costs, true))
4929 return TotalCost;
4930
4931 TotalCost = costs;
4932 }
4933 else if (!HasEnoughMoney(costs))
4934 {
4935 // LOG_DEBUG("entities.player", "You do not have enough money");
4936 return TotalCost;
4937 }
4938 else
4939 ModifyMoney(-int32(costs));
4940 }
4941 }
4942
4943 item->SetUInt32Value(ITEM_FIELD_DURABILITY, maxDurability);
4944 item->SetState(ITEM_CHANGED, this);
4945
4946 // reapply mods for total broken and repaired item if equipped
4947 if (IsEquipmentPos(pos) && !curDurability)
4948 _ApplyItemMods(item, pos & 255, true);
4949 return TotalCost;
4950}
DBCStorage< DurabilityQualityEntry > sDurabilityQualityStore(DurabilityQualityfmt)
DBCStorage< DurabilityCostsEntry > sDurabilityCostsStore(DurabilityCostsfmt)
uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemSubClass)
Definition ItemTemplate.h:557
@ RATE_REPAIRCOST
Definition WorldConfig.h:432
bool HandleMemberWithdrawMoney(WorldSession *session, uint32 amount, bool repair=false)
Definition Guild.cpp:1694
Definition DBCStructure.h:878
uint32 multiplier[29]
Definition DBCStructure.h:880
Definition DBCStructure.h:884
float quality_mod
Definition DBCStructure.h:886
uint32 ItemLevel
Definition ItemTemplate.h:635

References _ApplyItemMods(), ItemTemplate::Class, GetGuildId(), GetItemByPos(), GetSession(), Item::GetTemplate(), Object::GetUInt32Value(), Guild::HandleMemberWithdrawMoney(), HasEnoughMoney(), IsEquipmentPos(), ITEM_CHANGED, ITEM_FIELD_DURABILITY, ITEM_FIELD_MAXDURABILITY, ItemTemplate::ItemLevel, ItemSubClassToDurabilityMultiplierId(), LOG_ERROR, ModifyMoney(), DurabilityCostsEntry::multiplier, ItemTemplate::Quality, DurabilityQualityEntry::quality_mod, RATE_REPAIRCOST, sDurabilityCostsStore, sDurabilityQualityStore, Item::SetState(), Object::SetUInt32Value(), sGuildMgr, ItemTemplate::SubClass, and sWorld.

Referenced by DurabilityRepairAll(), and WorldSession::HandleRepairItemOpcode().

◆ DurabilityRepairAll()

uint32 Player::DurabilityRepairAll ( bool  cost,
float  discountMod,
bool  guildBank 
)
4857{
4858 uint32 TotalCost = 0;
4859 // equipped, backpack, bags itself
4861 TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i), cost, discountMod, guildBank);
4862
4863 // bank, buyback and keys not repaired
4864
4865 // items in inventory bags
4867 for (uint8 i = 0; i < MAX_BAG_SIZE; i++)
4868 TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank);
4869 return TotalCost;
4870}
uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank)
Definition Player.cpp:4872

References DurabilityRepair(), EQUIPMENT_SLOT_START, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and MAX_BAG_SIZE.

Referenced by WorldSession::HandleRepairItemOpcode().

◆ EnchantmentFitsRequirements()

bool Player::EnchantmentFitsRequirements ( uint32  enchantmentcondition,
int8  slot 
)
11101{
11102 if (!enchantmentcondition)
11103 return true;
11104
11105 SpellItemEnchantmentConditionEntry const* Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition);
11106
11107 if (!Condition)
11108 return true;
11109
11110 uint8 curcount[4] = {0, 0, 0, 0};
11111
11112 //counting current equipped gem colors
11114 {
11115 if (i == slot)
11116 continue;
11118 if (pItem2 && !pItem2->IsBroken() && pItem2->HasSocket())
11119 {
11120 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
11121 {
11122 if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
11123 continue;
11124
11125 uint32 enchant_id = pItem2->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11126 if (!enchant_id)
11127 continue;
11128
11129 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11130 if (!enchantEntry)
11131 continue;
11132
11133 uint32 gemid = enchantEntry->GemID;
11134 if (!gemid)
11135 continue;
11136
11137 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
11138 if (!gemProto)
11139 continue;
11140
11141 GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
11142 if (!gemProperty)
11143 continue;
11144
11145 uint8 GemColor = gemProperty->color;
11146
11147 for (uint8 b = 0, tmpcolormask = 1; b < 4; b++, tmpcolormask <<= 1)
11148 {
11149 if (tmpcolormask & GemColor)
11150 ++curcount[b];
11151 }
11152 }
11153 }
11154 }
11155
11156 bool activate = true;
11157
11158 for (uint8 i = 0; i < 5; i++)
11159 {
11160 if (!Condition->Color[i])
11161 continue;
11162
11163 uint32 _cur_gem = curcount[Condition->Color[i] - 1];
11164
11165 // if have <CompareColor> use them as count, else use <value> from Condition
11166 uint32 _cmp_gem = Condition->CompareColor[i] ? curcount[Condition->CompareColor[i] - 1] : Condition->Value[i];
11167
11168 switch (Condition->Comparator[i])
11169 {
11170 case 2: // requires less <color> than (<value> || <comparecolor>) gems
11171 activate &= (_cur_gem < _cmp_gem);
11172 break;
11173 case 3: // requires more <color> than (<value> || <comparecolor>) gems
11174 activate &= (_cur_gem > _cmp_gem);
11175 break;
11176 case 5: // requires at least <color> than (<value> || <comparecolor>) gems
11177 activate &= (_cur_gem >= _cmp_gem);
11178 break;
11179 }
11180 }
11181
11182 LOG_DEBUG("entities.player.items", "Checking Condition {}, there are {} Meta Gems, {} Red Gems, {} Yellow Gems and {} Blue Gems, Activate:{}", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no");
11183
11184 return activate;
11185}
DBCStorage< SpellItemEnchantmentConditionEntry > sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt)
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
@ BONUS_ENCHANTMENT_SLOT
Definition Item.h:174
Definition ConditionMgr.h:195
Definition DBCStructure.h:1015
uint32 color
Definition DBCStructure.h:1018
uint32 GemProperties
Definition ItemTemplate.h:683
Definition DBCStructure.h:1861

References BONUS_ENCHANTMENT_SLOT, GemPropertiesEntry::color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, SpellItemEnchantmentEntry::GemID, ItemTemplate::GemProperties, Item::GetEnchantmentId(), GetItemByPos(), Item::HasSocket(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), LOG_DEBUG, PRISMATIC_ENCHANTMENT_SLOT, sGemPropertiesStore, sObjectMgr, SOCK_ENCHANTMENT_SLOT, sSpellItemEnchantmentConditionStore, and sSpellItemEnchantmentStore.

Referenced by ApplyEnchantment(), and CorrectMetaGemEnchants().

◆ EnvironmentalDamage()

uint32 Player::EnvironmentalDamage ( EnviromentalDamage  type,
uint32  damage 
)
765{
767 return 0;
768
769 // Absorb, resist some environmental damage type
770 uint32 absorb = 0;
771 uint32 resist = 0;
772
773 switch (type)
774 {
775 case DAMAGE_LAVA:
776 case DAMAGE_SLIME:
777 {
778 DamageInfo dmgInfo(this, this, damage, nullptr, type == DAMAGE_LAVA ? SPELL_SCHOOL_MASK_FIRE : SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE);
779 Unit::CalcAbsorbResist(dmgInfo);
780 absorb = dmgInfo.GetAbsorb();
781 resist = dmgInfo.GetResist();
782 damage = dmgInfo.GetDamage();
783 }
784 default:
785 break;
786 }
787
788 Unit::DealDamageMods(this, damage, &absorb);
789
791 packet.Victim = GetGUID();
792 packet.Type = type != DAMAGE_FALL_TO_VOID ? type : DAMAGE_FALL;
793 packet.Amount = damage;
794 packet.Absorbed = absorb;
795 packet.Resisted = resist;
796 SendMessageToSet(packet.Write(), true);
797
798 uint32 final_damage = Unit::DealDamage(this, this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
799
800 if (!IsAlive())
801 {
802 if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
803 {
804 LOG_DEBUG("entities.player", "Player::EnvironmentalDamage: Player '{}' ({}) fall to death, losing {} durability",
805 GetName(), GetGUID().ToString(), sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f);
806 DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f, false);
807 // durability lost message
809 }
810
812 }
813
814 return final_damage;
815}
@ ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM
Definition DBCEnums.h:140
@ DAMAGE_SLIME
Definition Player.h:845
@ DAMAGE_FALL
Definition Player.h:843
@ DAMAGE_LAVA
Definition Player.h:844
@ DAMAGE_FALL_TO_VOID
Definition Player.h:847
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:300
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:299
@ SELF_DAMAGE
Definition Unit.h:254
@ DIRECT_DAMAGE
Definition Unit.h:249
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition WorldConfig.h:467
Definition Unit.h:331
uint32 GetResist() const
Definition Unit.h:367
uint32 GetDamage() const
Definition Unit.h:365
uint32 GetAbsorb() const
Definition Unit.h:366
void DurabilityLossAll(double percent, bool inventory)
Definition Player.cpp:4750
void SendDurabilityLoss()
Definition Player.cpp:4745
bool IsImmuneToEnvironmentalDamage()
Definition Player.cpp:758
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition Unit.cpp:2173
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:814
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition Unit.cpp:824
Definition CombatLogPackets.h:29
ObjectGuid Victim
Definition CombatLogPackets.h:35
uint32 Amount
Definition CombatLogPackets.h:37
uint32 Absorbed
Definition CombatLogPackets.h:39
EnviromentalDamage Type
Definition CombatLogPackets.h:36
uint32 Resisted
Definition CombatLogPackets.h:38
WorldPacket const * Write() override
Definition CombatLogPackets.cpp:20

References WorldPackets::CombatLog::EnvironmentalDamageLog::Absorbed, ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, WorldPackets::CombatLog::EnvironmentalDamageLog::Amount, Unit::CalcAbsorbResist(), DAMAGE_FALL, DAMAGE_FALL_TO_VOID, DAMAGE_LAVA, DAMAGE_SLIME, Unit::DealDamage(), Unit::DealDamageMods(), DIRECT_DAMAGE, DurabilityLossAll(), DamageInfo::GetAbsorb(), DamageInfo::GetDamage(), Object::GetGUID(), WorldObject::GetName(), DamageInfo::GetResist(), Unit::IsAlive(), IsImmuneToEnvironmentalDamage(), LOG_DEBUG, RATE_DURABILITY_LOSS_ON_DEATH, WorldPackets::CombatLog::EnvironmentalDamageLog::Resisted, SELF_DAMAGE, SendDurabilityLoss(), SendMessageToSet(), SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_NATURE, SPELL_SCHOOL_MASK_NORMAL, sWorld, Position::ToString(), WorldPackets::CombatLog::EnvironmentalDamageLog::Type, UpdateAchievementCriteria(), WorldPackets::CombatLog::EnvironmentalDamageLog::Victim, and WorldPackets::CombatLog::EnvironmentalDamageLog::Write().

Referenced by Spell::EffectEnvironmentalDMG(), HandleDrowning(), HandleFall(), and WorldSession::HandleMovementOpcodes().

◆ EquipItem()

Item * Player::EquipItem ( uint16  pos,
Item pItem,
bool  update 
)
2728{
2730 AddItemDurations(pItem);
2731
2732 uint8 bag = pos >> 8;
2733 uint8 slot = pos & 255;
2734
2735 Item* pItem2 = GetItemByPos(bag, slot);
2736
2737 if (!pItem2)
2738 {
2739 VisualizeItem(slot, pItem);
2740
2741 if (IsAlive())
2742 {
2743 ItemTemplate const* pProto = pItem->GetTemplate();
2744
2745 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
2746 if (pProto && pProto->ItemSet)
2747 AddItemsSetItem(this, pItem);
2748
2749 _ApplyItemMods(pItem, slot, true);
2750
2751 if (pProto && IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
2752 {
2753 uint32 cooldownSpell = IsClass(CLASS_ROGUE, CLASS_CONTEXT_WEAPON_SWAP) ? 6123 : 6119;
2754 SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
2755
2756 if (!spellProto)
2757 LOG_ERROR("entities.player", "Weapon switch cooldown spell {} couldn't be found in Spell.dbc", cooldownSpell);
2758 else
2759 {
2761
2763
2764 WorldPacket data;
2766 GetSession()->SendPacket(&data);
2767 }
2768 }
2769 }
2770
2771 if (IsInWorld() && update)
2772 {
2773 pItem->AddToWorld();
2774 pItem->SendUpdateToPlayer(this);
2775 }
2776
2777 ApplyEquipCooldown(pItem);
2778
2779 // update expertise and armor penetration - passive auras may need it
2780
2781 if (slot == EQUIPMENT_SLOT_MAINHAND)
2783
2784 else if (slot == EQUIPMENT_SLOT_OFFHAND)
2786
2787 switch (slot)
2788 {
2793 default:
2794 break;
2795 }
2796 }
2797 else
2798 {
2799 pItem2->SetCount(pItem2->GetCount() + pItem->GetCount());
2800 if (IsInWorld() && update)
2801 pItem2->SendUpdateToPlayer(this);
2802
2803 // delete item (it not in any slot currently)
2804 //pItem->DeleteFromDB();
2805 if (IsInWorld() && update)
2806 {
2807 pItem->RemoveFromWorld();
2808 pItem->DestroyForPlayer(this);
2809 }
2810
2812 RemoveItemDurations(pItem);
2813
2814 pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
2815 pItem->SetNotRefundable(this);
2816 pItem->ClearSoulboundTradeable(this);
2817 RemoveTradeableItem(pItem);
2818 pItem->SetState(ITEM_REMOVED, this);
2819 pItem2->SetState(ITEM_CHANGED, this);
2820
2821 ApplyEquipCooldown(pItem2);
2822 sScriptMgr->OnPlayerEquip(this, pItem2, bag, slot, update);
2823 return pItem2;
2824 }
2825
2826 // only for full equip instead adding to stack
2829
2830 sScriptMgr->OnPlayerEquip(this, pItem, bag, slot, update);
2832 return pItem;
2833}
@ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM
Definition DBCEnums.h:171
@ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM
Definition DBCEnums.h:163
@ CLASS_CONTEXT_WEAPON_SWAP
Definition UnitDefines.h:241
@ SPELL_COOLDOWN_FLAG_INCLUDE_GCD
Starts GCD in addition to normal cooldown specified in the packet.
Definition Unit.h:607
void AddGlobalCooldown(SpellInfo const *spellInfo, uint32 gcd)
Definition CharmInfo.cpp:419
void UpdateForQuestWorldObjects()
Definition PlayerUpdates.cpp:1793
void ApplyEquipCooldown(Item *pItem)
Definition Player.cpp:11740
void VisualizeItem(uint8 slot, Item *pItem)
Definition PlayerStorage.cpp:2875
uint32 StartRecoveryTime
Definition SpellInfo.h:351

References _ApplyItemMods(), ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, AddEnchantmentDurations(), GlobalCooldownMgr::AddGlobalCooldown(), AddItemDurations(), AddItemsSetItem(), Object::AddToWorld(), ApplyEquipCooldown(), BASE_ATTACK, Unit::BuildCooldownPacket(), ItemTemplate::Class, CLASS_CONTEXT_WEAPON_SWAP, CLASS_ROGUE, Item::ClearSoulboundTradeable(), CR_ARMOR_PENETRATION, Object::DestroyForPlayer(), EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, Item::GetCount(), Object::GetEntry(), GetGlobalCooldownMgr(), Object::GetGUID(), GetItemByPos(), GetSession(), Item::GetTemplate(), ItemTemplate::InventoryType, INVTYPE_RELIC, Unit::IsAlive(), IsClass(), Unit::IsInCombat(), Object::IsInWorld(), ITEM_CHANGED, ITEM_CLASS_WEAPON, ITEM_REMOVED, ItemTemplate::ItemSet, LOG_ERROR, m_weaponChangeTimer, OFF_ATTACK, RecalculateRating(), RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDurations(), RemoveTradeableItem(), WorldSession::SendPacket(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetNotRefundable(), Item::SetOwnerGUID(), Item::SetState(), SPELL_COOLDOWN_FLAG_INCLUDE_GCD, sScriptMgr, sSpellMgr, SpellInfo::StartRecoveryTime, UpdateAchievementCriteria(), UpdateExpertise(), UpdateForQuestWorldObjects(), and VisualizeItem().

Referenced by Create(), Spell::EffectSummonChangeItem(), EquipNewItem(), WorldSession::HandleAutoEquipItemOpcode(), SplitItem(), and SwapItem().

◆ EquipNewItem()

Item * Player::EquipNewItem ( uint16  pos,
uint32  item,
bool  update 
)
2708{
2709 Item* _item = Item::CreateItem(item, 1, this);
2710 if (!_item)
2711 return nullptr;
2712
2713 if (!IsEquipmentPos(pos) || sScriptMgr->OnPlayerCanSaveEquipNewItem(this, _item, pos, update))
2714 {
2715 // pussywizard: obtaining blue or better items saves to db
2716 if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
2717 if (pProto->Quality >= ITEM_QUALITY_RARE)
2719
2720 ItemAddedQuestCheck(item, 1);
2722 }
2723
2724 return EquipItem(pos, _item, update);
2725}
@ ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM
Definition DBCEnums.h:199
@ ITEM_QUALITY_RARE
Definition SharedDefines.h:332
void ItemAddedQuestCheck(uint32 entry, uint32 count)
Definition PlayerQuest.cpp:1835

References ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, ADDITIONAL_SAVING_INVENTORY_AND_GOLD, AdditionalSavingAddMask(), Item::CreateItem(), EquipItem(), IsEquipmentPos(), ITEM_QUALITY_RARE, ItemAddedQuestCheck(), sObjectMgr, sScriptMgr, and UpdateAchievementCriteria().

Referenced by _StoreOrEquipNewItem(), and StoreNewItemInBestSlots().

◆ ExecuteOrCancelSpellCastRequest()

void Player::ExecuteOrCancelSpellCastRequest ( PendingSpellCastRequest castRequest,
bool  isCancel = false 
)
2365{
2366 if (isCancel)
2367 request->cancelInProgress = true;
2368
2369 if (WorldSession* session = GetSession())
2370 {
2371 if (request->isItem)
2372 session->HandleUseItemOpcode(request->requestPacket);
2373 else
2374 session->HandleCastSpellOpcode(request->requestPacket);
2375 }
2376}

References PendingSpellCastRequest::cancelInProgress, GetSession(), PendingSpellCastRequest::isItem, and PendingSpellCastRequest::requestPacket.

Referenced by ProcessSpellQueue().

◆ FailQuest()

void Player::FailQuest ( uint32  quest_id)
887{
888 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
889 {
890 QuestStatus qStatus = GetQuestStatus(questId);
891 // xinef: if quest is marked as failed, dont do it again
892 if ((qStatus != QUEST_STATUS_INCOMPLETE) && (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE)))
893 return;
894
896
897 uint16 log_slot = FindQuestSlot(questId);
898
899 if (log_slot < MAX_QUEST_LOG_SIZE)
900 {
901 SetQuestSlotTimer(log_slot, 1);
903 }
904
905 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
906 {
907 QuestStatusData& q_status = m_QuestStatus[questId];
908
909 RemoveTimedQuest(questId);
910 q_status.Timer = 0;
911
912 SendQuestTimerFailed(questId);
913 }
914 else
915 SendQuestFailed(questId);
916
917 // Destroy quest items on quest failure.
918 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
919 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
920 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
921 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
922
923 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
924 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
925 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
926 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
927 }
928}
@ QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE
Definition QuestDef.h:167
void SendQuestTimerFailed(uint32 quest_id)
Definition PlayerQuest.cpp:2394
void SendQuestFailed(uint32 questId, InventoryResult reason=EQUIP_ERR_OK)
Definition PlayerQuest.cpp:2382
void SetQuestSlotTimer(uint16 slot, uint32 timer)
Definition Player.h:1520
void RemoveTimedQuest(uint32 quest_id)
Definition Player.h:1571

References BIND_QUEST_ITEM, DestroyItemCount(), FindQuestSlot(), GetQuestStatus(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATE_FAIL, QUEST_STATUS_FAILED, QUEST_STATUS_INCOMPLETE, RemoveTimedQuest(), SendQuestFailed(), SendQuestTimerFailed(), SetQuestSlotState(), SetQuestSlotTimer(), SetQuestStatus(), sObjectMgr, and QuestStatusData::Timer.

Referenced by npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), SmartAI::EndPath(), dragonmaw_race_npc::FailQuest(), npc_clintar_spirit::npc_clintar_spiritAI::JustDied(), npc_captain_saeed::npc_captain_saeedAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_doctor::npc_doctorAI::PatientDied(), Map::ScriptsProcess(), Update(), and npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI().

◆ FindEquipSlot()

uint8 Player::FindEquipSlot ( ItemTemplate const *  proto,
uint32  slot,
bool  swap 
) const
126{
127 uint8 slots[4];
128 slots[0] = NULL_SLOT;
129 slots[1] = NULL_SLOT;
130 slots[2] = NULL_SLOT;
131 slots[3] = NULL_SLOT;
132 switch (proto->InventoryType)
133 {
134 case INVTYPE_HEAD:
135 slots[0] = EQUIPMENT_SLOT_HEAD;
136 break;
137 case INVTYPE_NECK:
138 slots[0] = EQUIPMENT_SLOT_NECK;
139 break;
141 slots[0] = EQUIPMENT_SLOT_SHOULDERS;
142 break;
143 case INVTYPE_BODY:
144 slots[0] = EQUIPMENT_SLOT_BODY;
145 break;
146 case INVTYPE_CHEST:
147 case INVTYPE_ROBE:
148 slots[0] = EQUIPMENT_SLOT_CHEST;
149 break;
150 case INVTYPE_WAIST:
151 slots[0] = EQUIPMENT_SLOT_WAIST;
152 break;
153 case INVTYPE_LEGS:
154 slots[0] = EQUIPMENT_SLOT_LEGS;
155 break;
156 case INVTYPE_FEET:
157 slots[0] = EQUIPMENT_SLOT_FEET;
158 break;
159 case INVTYPE_WRISTS:
160 slots[0] = EQUIPMENT_SLOT_WRISTS;
161 break;
162 case INVTYPE_HANDS:
163 slots[0] = EQUIPMENT_SLOT_HANDS;
164 break;
165 case INVTYPE_FINGER:
166 slots[0] = EQUIPMENT_SLOT_FINGER1;
167 slots[1] = EQUIPMENT_SLOT_FINGER2;
168 break;
169 case INVTYPE_TRINKET:
170 slots[0] = EQUIPMENT_SLOT_TRINKET1;
171 slots[1] = EQUIPMENT_SLOT_TRINKET2;
172 break;
173 case INVTYPE_CLOAK:
174 slots[0] = EQUIPMENT_SLOT_BACK;
175 break;
176 case INVTYPE_WEAPON:
177 {
178 slots[0] = EQUIPMENT_SLOT_MAINHAND;
179
180 // suggest offhand slot only if know dual wielding
181 // (this will be replace mainhand weapon at auto equip instead unwonted "you don't known dual wielding" ...
182 if (CanDualWield())
183 slots[1] = EQUIPMENT_SLOT_OFFHAND;
184 break;
185 }
186 case INVTYPE_SHIELD:
188 case INVTYPE_HOLDABLE:
189 slots[0] = EQUIPMENT_SLOT_OFFHAND;
190 break;
191 case INVTYPE_RANGED:
193 case INVTYPE_THROWN:
194 slots[0] = EQUIPMENT_SLOT_RANGED;
195 break;
196 case INVTYPE_2HWEAPON:
197 slots[0] = EQUIPMENT_SLOT_MAINHAND;
198 if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
200 if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
201 if (mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
202 slots[1] = EQUIPMENT_SLOT_OFFHAND;
203 break;
204 case INVTYPE_TABARD:
205 slots[0] = EQUIPMENT_SLOT_TABARD;
206 break;
208 slots[0] = EQUIPMENT_SLOT_MAINHAND;
209 break;
210 case INVTYPE_BAG:
211 slots[0] = INVENTORY_SLOT_BAG_START + 0;
212 slots[1] = INVENTORY_SLOT_BAG_START + 1;
213 slots[2] = INVENTORY_SLOT_BAG_START + 2;
214 slots[3] = INVENTORY_SLOT_BAG_START + 3;
215 break;
216 case INVTYPE_RELIC:
217 {
218 switch (proto->SubClass)
219 {
222 slots[0] = EQUIPMENT_SLOT_RANGED;
223 break;
226 slots[0] = EQUIPMENT_SLOT_RANGED;
227 break;
230 slots[0] = EQUIPMENT_SLOT_RANGED;
231 break;
234 slots[0] = EQUIPMENT_SLOT_RANGED;
235 break;
238 slots[0] = EQUIPMENT_SLOT_RANGED;
239 break;
240 }
241 break;
242 }
243 default:
244 return NULL_SLOT;
245 }
246
247 if (slot != NULL_SLOT)
248 {
249 if (swap || !GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
250 for (uint8 i = 0; i < 4; ++i)
251 if (slots[i] == slot)
252 return slot;
253 }
254 else
255 {
256 // search free slot at first
257 for (uint8 i = 0; i < 4; ++i)
258 if (slots[i] != NULL_SLOT && !GetItemByPos(INVENTORY_SLOT_BAG_0, slots[i]))
259 // in case 2hand equipped weapon (without titan grip) offhand slot empty but not free
260 if (slots[i] != EQUIPMENT_SLOT_OFFHAND || !IsTwoHandUsed())
261 return slots[i];
262
263 // if not found free and can swap return first appropriate from used
264 for (uint8 i = 0; i < 4; ++i)
265 if (slots[i] != NULL_SLOT && swap)
266 return slots[i];
267 }
268
269 // no free position
270 return NULL_SLOT;
271}
@ INVTYPE_BODY
Definition ItemTemplate.h:260
@ INVTYPE_FINGER
Definition ItemTemplate.h:267
@ INVTYPE_HEAD
Definition ItemTemplate.h:257
@ INVTYPE_ROBE
Definition ItemTemplate.h:276
@ INVTYPE_HOLDABLE
Definition ItemTemplate.h:279
@ INVTYPE_TRINKET
Definition ItemTemplate.h:268
@ INVTYPE_RANGED
Definition ItemTemplate.h:271
@ INVTYPE_THROWN
Definition ItemTemplate.h:281
@ INVTYPE_WAIST
Definition ItemTemplate.h:262
@ INVTYPE_RANGEDRIGHT
Definition ItemTemplate.h:282
@ INVTYPE_WRISTS
Definition ItemTemplate.h:265
@ INVTYPE_WEAPONMAINHAND
Definition ItemTemplate.h:277
@ INVTYPE_BAG
Definition ItemTemplate.h:274
@ INVTYPE_NECK
Definition ItemTemplate.h:258
@ INVTYPE_SHOULDERS
Definition ItemTemplate.h:259
@ INVTYPE_FEET
Definition ItemTemplate.h:264
@ INVTYPE_SHIELD
Definition ItemTemplate.h:270
@ INVTYPE_TABARD
Definition ItemTemplate.h:275
@ INVTYPE_LEGS
Definition ItemTemplate.h:263
@ INVTYPE_CHEST
Definition ItemTemplate.h:261
@ INVTYPE_HANDS
Definition ItemTemplate.h:266
@ EQUIPMENT_SLOT_SHOULDERS
Definition Player.h:684
@ EQUIPMENT_SLOT_BODY
Definition Player.h:685
@ EQUIPMENT_SLOT_HANDS
Definition Player.h:691
@ EQUIPMENT_SLOT_NECK
Definition Player.h:683
@ EQUIPMENT_SLOT_TABARD
Definition Player.h:700
@ EQUIPMENT_SLOT_HEAD
Definition Player.h:682
@ EQUIPMENT_SLOT_LEGS
Definition Player.h:688
@ EQUIPMENT_SLOT_BACK
Definition Player.h:696
@ EQUIPMENT_SLOT_WAIST
Definition Player.h:687
@ EQUIPMENT_SLOT_FEET
Definition Player.h:689
@ EQUIPMENT_SLOT_CHEST
Definition Player.h:686
@ EQUIPMENT_SLOT_WRISTS
Definition Player.h:690

References Unit::CanDualWield(), CanTitanGrip(), CLASS_CONTEXT_EQUIP_RELIC, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_PALADIN, CLASS_SHAMAN, CLASS_WARLOCK, EQUIPMENT_SLOT_BACK, EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_CHEST, EQUIPMENT_SLOT_FEET, EQUIPMENT_SLOT_FINGER1, EQUIPMENT_SLOT_FINGER2, EQUIPMENT_SLOT_HANDS, EQUIPMENT_SLOT_HEAD, EQUIPMENT_SLOT_LEGS, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_NECK, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_SHOULDERS, EQUIPMENT_SLOT_TABARD, EQUIPMENT_SLOT_TRINKET1, EQUIPMENT_SLOT_TRINKET2, EQUIPMENT_SLOT_WAIST, EQUIPMENT_SLOT_WRISTS, GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_START, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_BAG, INVTYPE_BODY, INVTYPE_CHEST, INVTYPE_CLOAK, INVTYPE_FEET, INVTYPE_FINGER, INVTYPE_HANDS, INVTYPE_HEAD, INVTYPE_HOLDABLE, INVTYPE_LEGS, INVTYPE_NECK, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_RELIC, INVTYPE_ROBE, INVTYPE_SHIELD, INVTYPE_SHOULDERS, INVTYPE_TABARD, INVTYPE_THROWN, INVTYPE_TRINKET, INVTYPE_WAIST, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, INVTYPE_WRISTS, IsClass(), IsTwoHandUsed(), ITEM_SUBCLASS_ARMOR_IDOL, ITEM_SUBCLASS_ARMOR_LIBRAM, ITEM_SUBCLASS_ARMOR_MISC, ITEM_SUBCLASS_ARMOR_SIGIL, ITEM_SUBCLASS_ARMOR_TOTEM, ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_POLEARM, ITEM_SUBCLASS_WEAPON_STAFF, NULL_SLOT, and ItemTemplate::SubClass.

Referenced by CanEquipItem(), and WorldSession::HandleAutoEquipItemOpcode().

◆ FindQuestSlot()

uint16 Player::FindQuestSlot ( uint32  quest_id) const

◆ GetAchievementMgr()

AchievementMgr * Player::GetAchievementMgr ( ) const
inline
2553{ return m_achievementMgr; }

References m_achievementMgr.

◆ GetActionButton()

ActionButton const * Player::GetActionButton ( uint8  button)
5685{
5686 ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
5687 if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
5688 return nullptr;
5689
5690 return &buttonItr->second;
5691}

References ACTIONBUTTON_DELETED, and m_actionButtons.

Referenced by Spell::EffectCastButtons().

◆ GetActiveSpec()

◆ GetActiveSpecMask()

uint8 Player::GetActiveSpecMask ( ) const
inline

◆ GetAmmoDPS()

float Player::GetAmmoDPS ( ) const
inline
1344{ return m_ammoDPS; }

References m_ammoDPS.

Referenced by _ApplyAmmoBonuses(), and CalculateMinMaxDamage().

◆ GetArenaPersonalRating()

uint32 Player::GetArenaPersonalRating ( uint8  slot) const
16170{
16172
16173 sScriptMgr->OnPlayerGetArenaPersonalRating(const_cast<Player*>(this), slot, result);
16174
16175 return result;
16176}

References ARENA_TEAM_END, ARENA_TEAM_PERSONAL_RATING, Object::GetUInt32Value(), PLAYER_FIELD_ARENA_TEAM_INFO_1_1, and sScriptMgr.

Referenced by GetMaxPersonalArenaRatingRequirement().

◆ GetArenaPoints()

uint32 Player::GetArenaPoints ( ) const
inline

◆ GetArenaTeamId()

◆ GetArenaTeamIdFromDB()

uint32 Player::GetArenaTeamIdFromDB ( ObjectGuid  guid,
uint8  slot 
)
static
6337{
6339 stmt->SetData(0, guid.GetCounter());
6340 stmt->SetData(1, type);
6341 PreparedQueryResult result = CharacterDatabase.Query(stmt);
6342
6343 if (!result)
6344 return 0;
6345
6346 uint32 id = (*result)[0].Get<uint32>();
6347 return id;
6348}
@ CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID
Definition CharacterDatabase.h:352

References CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID, CharacterDatabase, ObjectGuid::GetCounter(), and PreparedStatementBase::SetData().

Referenced by arena_commandscript::HandleArenaCreateCommand().

◆ GetArenaTeamIdInvited()

◆ GetArmorProficiency()

uint32 Player::GetArmorProficiency ( ) const
inline
1377{ return m_ArmorProficiency; }

References m_ArmorProficiency.

Referenced by Spell::EffectProficiency().

◆ GetAttackBySlot()

◆ GetAurasForTarget()

void Player::GetAurasForTarget ( Unit target,
bool  force = false 
)

Blizz sends certain movement packets sometimes even before CreateObject These movement packets are usually found in SMSG_COMPRESSED_MOVES

12030{
12031 if (!target || (!force && target->GetVisibleAuras()->empty())) // speedup things
12032 return;
12033
12037 if (target->HasFeatherFallAura())
12038 target->SendMovementFeatherFall(this);
12039
12040 if (target->HasWaterWalkAura())
12041 target->SendMovementWaterWalking(this);
12042
12043 if (target->HasHoverAura())
12044 target->SendMovementHover(this);
12045
12047 data<< target->GetPackGUID();
12048
12049 Unit::VisibleAuraMap const* visibleAuras = target->GetVisibleAuras();
12050 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
12051 {
12052 AuraApplication* auraApp = itr->second;
12053 auraApp->BuildUpdatePacket(data, false);
12054 }
12055
12056 GetSession()->SendPacket(&data);
12057}
Definition SpellAuras.h:37
void BuildUpdatePacket(ByteBuffer &data, bool remove) const
Definition SpellAuras.cpp:248
bool HasWaterWalkAura() const
Definition Unit.h:1714
bool HasFeatherFallAura() const
Definition Unit.h:1715
void SendMovementHover(Player *sendTo)
Definition Unit.cpp:20560
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition Unit.h:642
void SendMovementWaterWalking(Player *sendTo)
Definition Unit.cpp:20501
bool HasHoverAura() const
Definition Unit.h:1716
VisibleAuraMap const * GetVisibleAuras()
Definition Unit.h:1458
void SendMovementFeatherFall(Player *sendTo)
Definition Unit.cpp:20523
@ SMSG_AURA_UPDATE_ALL
Definition Opcodes.h:1203

References AuraApplication::BuildUpdatePacket(), Object::GetPackGUID(), GetSession(), Unit::GetVisibleAuras(), Unit::HasFeatherFallAura(), Unit::HasHoverAura(), Unit::HasWaterWalkAura(), Unit::SendMovementFeatherFall(), Unit::SendMovementHover(), Unit::SendMovementWaterWalking(), WorldSession::SendPacket(), and SMSG_AURA_UPDATE_ALL.

Referenced by GetInitialVisiblePackets(), and Map::SendInitSelf().

◆ GetAuraUpdateMaskForRaid()

uint64 Player::GetAuraUpdateMaskForRaid ( ) const
inline

◆ GetAverageItemLevel()

float Player::GetAverageItemLevel ( )
15691{
15692 float sum = 0;
15693 uint32 count = 0;
15694 uint8 level = GetLevel();
15695
15697 {
15698 // don't check tabard, ranged, offhand or shirt
15700 continue;
15701
15702 if (m_items[i] && m_items[i]->GetTemplate())
15704
15705 ++count;
15706 }
15707
15708 return std::max<float>(0.0f, sum / (float)count);
15709}
float GetItemLevelIncludingQuality(uint8 pLevel) const
Definition ItemTemplate.h:758

References EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, ItemTemplate::GetItemLevelIncludingQuality(), Unit::GetLevel(), Item::GetTemplate(), and m_items.

Referenced by spell_gen_vehicle_scaling_aura::CalculateAmount(), gear_commandscript::HandleGearStatsCommand(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetAverageItemLevelForDF()

float Player::GetAverageItemLevelForDF ( )
15712{
15713 float sum = 0;
15714 uint32 count = 0;
15715 uint8 level = GetLevel();
15716
15717 for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
15718 {
15719 // don't check tabard, ranged, offhand or shirt
15721 continue;
15722
15723 if (m_items[i] && m_items[i]->GetTemplate())
15724 {
15725 if (m_items[i]->GetTemplate()->Quality == ITEM_QUALITY_HEIRLOOM)
15726 sum += level * 2.33f;
15727 else
15728 sum += m_items[i]->GetTemplate()->ItemLevel;
15729 }
15730
15731 ++count;
15732 }
15733
15734 return std::max(0.0f, sum / (float)count);
15735}

References EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, Unit::GetLevel(), Item::GetTemplate(), ITEM_QUALITY_HEIRLOOM, ItemTemplate::ItemLevel, and m_items.

Referenced by lfg::LFGMgr::InitializeLockedDungeons(), and Satisfy().

◆ GetBagByPos()

◆ GetBankBagSlotCount()

uint8 Player::GetBankBagSlotCount ( ) const
inline

◆ GetBarberShopCost()

uint32 Player::GetBarberShopCost ( uint8  newhairstyle,
uint8  newhaircolor,
uint8  newfacialhair,
BarberShopStyleEntry const *  newSkin = nullptr 
)
13216{
13217 uint8 level = GetLevel();
13218
13219 if (level > GT_MAX_LEVEL)
13220 level = GT_MAX_LEVEL; // max level in this dbc
13221
13222 uint8 hairstyle = GetByteValue(PLAYER_BYTES, 2);
13223 uint8 haircolor = GetByteValue(PLAYER_BYTES, 3);
13224 uint8 facialhair = GetByteValue(PLAYER_BYTES_2, 0);
13225 uint8 skincolor = GetByteValue(PLAYER_BYTES, 0);
13226
13227 if ((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair) && (!newSkin || (newSkin->hair_id == skincolor)))
13228 return 0;
13229
13230 GtBarberShopCostBaseEntry const* bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);
13231
13232 if (!bsc) // shouldn't happen
13233 return 0xFFFFFFFF;
13234
13235 float cost = 0;
13236
13237 if (hairstyle != newhairstyle)
13238 cost += bsc->cost; // full price
13239
13240 if ((haircolor != newhaircolor) && (hairstyle == newhairstyle))
13241 cost += bsc->cost * 0.5f; // +1/2 of price
13242
13243 if (facialhair != newfacialhair)
13244 cost += bsc->cost * 0.75f; // +3/4 of price
13245
13246 if (newSkin && skincolor != newSkin->hair_id)
13247 cost += bsc->cost * 0.75f; // +5/6 of price
13248
13249 return uint32(cost);
13250}
DBCStorage< GtBarberShopCostBaseEntry > sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt)
#define GT_MAX_LEVEL
Definition DBCStructure.h:1037
Definition DBCStructure.h:1043
float cost
Definition DBCStructure.h:1044

References GtBarberShopCostBaseEntry::cost, Object::GetByteValue(), Unit::GetLevel(), GT_MAX_LEVEL, BarberShopStyleEntry::hair_id, PLAYER_BYTES, PLAYER_BYTES_2, and sGtBarberShopCostBaseStore.

Referenced by WorldSession::HandleAlterAppearance().

◆ GetBaseDefenseSkillValue()

uint32 Player::GetBaseDefenseSkillValue ( ) const
inline
@ SKILL_DEFENSE
Definition SharedDefines.h:3120
uint16 GetBaseSkillValue(uint32 skill) const
Definition Player.cpp:5534

References GetBaseSkillValue(), and SKILL_DEFENSE.

Referenced by UpdateCombatSkills().

◆ GetBaseModValue()

float Player::GetBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType 
) const
5092{
5093 if (modGroup >= BASEMOD_END)
5094 {
5095 LOG_ERROR("entities.player", "trial to access non existed BaseModGroup!");
5096 return 0.0f;
5097 }
5098
5099 if (modType == PCT_MOD && m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
5100 return 0.0f;
5101
5102 return m_auraBaseMod[modGroup][modType];
5103}

References BASEMOD_END, LOG_ERROR, m_auraBaseMod, and PCT_MOD.

◆ GetBaseRune()

RuneType Player::GetBaseRune ( uint8  index) const
inline
2523{ return RuneType(m_runes->runes[index].BaseRune); }
RuneType
Definition Player.h:414
uint8 BaseRune
Definition Player.h:424
RuneInfo runes[MAX_RUNES]
Definition Player.h:433

References RuneInfo::BaseRune, m_runes, and Runes::runes.

Referenced by Spell::EffectActivateRune(), GetRuneBaseCooldown(), IsBaseRuneSlotsOnCooldown(), RemoveRunesByAuraEffect(), RestoreBaseRune(), Spell::TakeRunePower(), and UpdateRuneRegen().

◆ GetBaseSkillValue()

uint16 Player::GetBaseSkillValue ( uint32  skill) const
5535{
5536 if (!skill)
5537 return 0;
5538
5539 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5540 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5541 return 0;
5542
5543 int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5544 result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
5545 return result < 0 ? 0 : result;
5546}
#define SKILL_PERM_BONUS(x)
Definition Player.h:87

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_PERM_BONUS, and SKILL_VALUE.

Referenced by npc_engineering_tele_trinket::CanLearn(), GetBaseDefenseSkillValue(), GetBaseWeaponSkillValue(), GetTrainerSpellState(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), and SatisfyQuestSkill().

◆ GetBaseSpellDamageBonus()

uint32 Player::GetBaseSpellDamageBonus ( )
inline
1987{ return m_baseSpellDamage; }

References m_baseSpellDamage.

Referenced by Unit::SpellBaseDamageBonusDone().

◆ GetBaseSpellHealingBonus()

uint32 Player::GetBaseSpellHealingBonus ( )
inline
1988{ return m_baseSpellHealing; }

References m_baseSpellHealing.

Referenced by Unit::SpellBaseHealingBonusDone().

◆ GetBaseSpellPowerBonus()

uint32 Player::GetBaseSpellPowerBonus ( )
inline

◆ GetBaseWeaponSkillValue()

uint32 Player::GetBaseWeaponSkillValue ( WeaponAttackType  attType) const
12779{
12780 Item* item = GetWeaponForAttack(attType, true);
12781
12782 // unarmed only with base attack
12783 if (attType != BASE_ATTACK && !item)
12784 return 0;
12785
12786 // weapon skill or (unarmed for base attack)
12787 uint32 skill = item ? item->GetSkill() : uint32(SKILL_UNARMED);
12788 return GetBaseSkillValue(skill);
12789}
@ SKILL_UNARMED
Definition SharedDefines.h:3146

References BASE_ATTACK, GetBaseSkillValue(), Item::GetSkill(), GetWeaponForAttack(), and SKILL_UNARMED.

Referenced by UpdateCombatSkills().

◆ GetBattleground()

Battleground * Player::GetBattleground ( bool  create = false) const
12166{
12167 if (GetBattlegroundId() == 0)
12168 return nullptr;
12169
12171 return (create || (bg && bg->FindBgMap()) ? bg : nullptr);
12172}
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187
BattlegroundMap * FindBgMap() const
Definition Battleground.h:441
BattlegroundTypeId GetBattlegroundTypeId() const
Definition Player.h:2273
uint32 GetBattlegroundId() const
Definition Player.h:2272

References Battleground::FindBgMap(), GetBattlegroundId(), GetBattlegroundTypeId(), and sBattlegroundMgr.

Referenced by GameObject::ActivateToQuest(), CanEquipItem(), Group::CanJoinBattlegroundQueue(), CanUnequipItem(), Spell::CheckCast(), MapInstanced::CreateInstanceForPlayer(), Object::DestroyForPlayer(), Spell::EffectOpenLock(), WorldSession::HandleAreaSpiritHealerQueryOpcode(), WorldSession::HandleAreaSpiritHealerQueueOpcode(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModEffectImmunity(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlegroundPlayerPositionsOpcode(), spell_item_rocket_boots::HandleDummy(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePVPLogDataOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), spell_ioc_gunship_portal::HandleScript2(), InArena(), SpellArea::IsFitToRequirements(), Unit::Kill(), LeaveBattleground(), AchievementCriteriaData::Meets(), Unit::Mount(), achievement_resilient_victory::OnCheck(), achievement_bg_control_all_nodes::OnCheck(), achievement_bg_ic_resource_glut::OnCheck(), achievement_arena_by_type::OnCheck(), achievement_everything_counts::OnCheck(), achievement_bg_av_perfection::OnCheck(), achievement_sa_defense_of_the_ancients::OnCheck(), achievement_not_even_a_scratch::OnCheck(), achievement_save_the_day::OnCheck(), go_arena_ready_marker::OnGossipHello(), RepopAtGraveyard(), ReportedAfkBy(), ResurrectPlayer(), RewardHonor(), SendInitWorldStates(), SendLoot(), SummonIfPossible(), AchievementMgr::UpdateAchievementCriteria(), and GameObject::Use().

◆ GetBattlegroundId()

◆ GetBattlegroundQueueIndex()

◆ GetBattlegroundQueueTypeId()

BattlegroundQueueTypeId Player::GetBattlegroundQueueTypeId ( uint32  index) const

◆ GetBattlegroundTypeId()

BattlegroundTypeId Player::GetBattlegroundTypeId ( ) const
inline
2273{ return m_bgData.bgTypeID; }
BattlegroundTypeId bgTypeID
Definition Player.h:1043

References BGData::bgTypeID, and m_bgData.

Referenced by GetBattleground(), and ArenaSpectator::HandleSpectatorSpectateCommand().

◆ GetBGAccessByLevel()

bool Player::GetBGAccessByLevel ( BattlegroundTypeId  bgTypeId) const
12288{
12289 // get a template bg instead of running one
12290 Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
12291 if (!bgt)
12292 return false;
12293
12294 // limit check leel to dbc compatible level range
12295 uint32 level = GetLevel();
12296 if (level > DEFAULT_MAX_LEVEL)
12297 level = DEFAULT_MAX_LEVEL;
12298
12299 if (level < bgt->GetMinLevel() || level > bgt->GetMaxLevel())
12300 return false;
12301
12302 return true;
12303}
uint32 GetMaxLevel() const
Definition Battleground.h:330

References DEFAULT_MAX_LEVEL, Unit::GetLevel(), Battleground::GetMaxLevel(), and sBattlegroundMgr.

Referenced by Group::CanJoinBattlegroundQueue(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleBattlemasterJoinOpcode(), and Creature::isCanInteractWithBattleMaster().

◆ GetBGData()

BGData & Player::GetBGData ( )
inline
2277{ return m_bgData; }

References m_bgData.

◆ GetBgTeamId()

◆ GetBonusTalentCount()

uint32 Player::GetBonusTalentCount ( )
inline
1748{ return m_extraBonusTalentCount; };

References m_extraBonusTalentCount.

◆ GetCastRequest()

const PendingSpellCastRequest * Player::GetCastRequest ( uint32  category) const
2332{
2333 for (const PendingSpellCastRequest& request : SpellQueue)
2334 if (request.category == category)
2335 return &request;
2336 return nullptr;
2337}
std::deque< PendingSpellCastRequest > SpellQueue
Definition Player.h:2659
Definition Player.h:1071

References SpellQueue.

Referenced by CanRequestSpellCast().

◆ GetChampioningFaction()

uint32 Player::GetChampioningFaction ( ) const
inline
2567{ return m_ChampioningFaction; }

References m_ChampioningFaction.

Referenced by RewardReputation().

◆ GetChatTag()

uint8 Player::GetChatTag ( ) const
1319{
1320 uint8 tag = CHAT_TAG_NONE;
1321
1322 if (isGMChat())
1323 tag |= CHAT_TAG_GM;
1324 if (isDND())
1325 tag |= CHAT_TAG_DND;
1326 if (isAFK())
1327 tag |= CHAT_TAG_AFK;
1328 if (IsCommentator())
1329 tag |= CHAT_TAG_COM;
1330 if (IsDeveloper())
1331 tag |= CHAT_TAG_DEV;
1332
1333 return tag;
1334}
@ CHAT_TAG_COM
Definition Player.h:856
@ CHAT_TAG_DND
Definition Player.h:854
@ CHAT_TAG_DEV
Definition Player.h:857
@ CHAT_TAG_AFK
Definition Player.h:853
@ CHAT_TAG_GM
Definition Player.h:855
@ CHAT_TAG_NONE
Definition Player.h:852
bool IsCommentator() const
Definition Player.h:1171
bool isGMChat() const
Definition Player.h:1179
bool isDND() const
Definition Player.h:1154
bool IsDeveloper() const
Definition Player.h:1173
bool isAFK() const
Definition Player.h:1153

References CHAT_TAG_AFK, CHAT_TAG_COM, CHAT_TAG_DEV, CHAT_TAG_DND, CHAT_TAG_GM, CHAT_TAG_NONE, isAFK(), IsCommentator(), IsDeveloper(), isDND(), and isGMChat().

◆ getCinematic()

uint8 Player::getCinematic ( ) const
inline
1845 {
1846 return m_cinematic;
1847 }

References m_cinematic.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ GetCinematicMgr()

CinematicMgr * Player::GetCinematicMgr ( ) const
inline

◆ GetCommandStatus()

◆ GetCorpse()

◆ GetCorpseLocation()

◆ GetCorpseReclaimDelay()

uint32 Player::GetCorpseReclaimDelay ( bool  pvp) const
12886{
12887 if (pvp)
12888 {
12889 if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP))
12890 return copseReclaimDelay[0];
12891 }
12892 else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
12893 return 0;
12894
12895 time_t now = GameTime::GetGameTime().count();
12896 // 0..2 full period
12897 // should be std::ceil(x)-1 but not floor(x)
12898 uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
12899 return copseReclaimDelay[count];
12900}

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, copseReclaimDelay, DEATH_EXPIRE_STEP, GameTime::GetGameTime(), m_deathExpireTime, and sWorld.

Referenced by CalculateCorpseReclaimDelay(), and WorldSession::HandleReclaimCorpseOpcode().

◆ GetCreationTime()

Seconds Player::GetCreationTime ( ) const
inline
2556{ return m_creationTime; }

References m_creationTime.

◆ GetCurrentBattlegroundQueueSlot()

uint32 Player::GetCurrentBattlegroundQueueSlot ( ) const
inline

◆ GetCurrentRune()

RuneType Player::GetCurrentRune ( uint8  index) const
inline

◆ GetDeathTimer()

uint32 Player::GetDeathTimer ( ) const
inline
2194{ return m_deathTimer; }

References m_deathTimer.

Referenced by WorldSession::LogoutPlayer().

◆ GetDebugInfo()

std::string Player::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

16319{
16320 std::stringstream sstr;
16321 sstr << Unit::GetDebugInfo();
16322 return sstr.str();
16323}
std::string GetDebugInfo() const override
Definition Unit.cpp:21195

References Unit::GetDebugInfo().

◆ GetDeclinedNames()

DeclinedName const * Player::GetDeclinedNames ( ) const
inline
2521{ return m_declinedname; }

References m_declinedname.

◆ GetDefaultGossipMenuForSource()

uint32 Player::GetDefaultGossipMenuForSource ( WorldObject source)
static
423{
424 switch (source->GetTypeId())
425 {
426 case TYPEID_UNIT:
427 return source->ToCreature()->GetCreatureTemplate()->GossipMenuId;
429 return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
430 default:
431 break;
432 }
433
434 return 0;
435}
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:136
uint32 GossipMenuId
Definition CreatureData.h:194
uint32 GetGossipMenuId() const
Definition GameObjectData.h:552

References Creature::GetCreatureTemplate(), GameObject::GetGOInfo(), GameObjectTemplate::GetGossipMenuId(), Object::GetTypeId(), CreatureTemplate::GossipMenuId, Object::ToCreature(), Object::ToGameObject(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by GetGossipTextId(), and PrepareGossipMenu().

◆ GetDelayedOperations()

uint32 Player::GetDelayedOperations ( ) const
inline

◆ GetDifficulty()

◆ GetDivider()

◆ GetDodgeFromAgility()

void Player::GetDodgeFromAgility ( float &  diminishing,
float &  nondiminishing 
)
Todo:
: research if talents/effects that increase total agility by x% should increase non-diminishing part
5146{
5147 // Table for base dodge values
5148 const float dodge_base[MAX_CLASSES] =
5149 {
5150 0.036640f, // Warrior
5151 0.034943f, // Paladi
5152 -0.040873f, // Hunter
5153 0.020957f, // Rogue
5154 0.034178f, // Priest
5155 0.036640f, // DK
5156 0.021080f, // Shaman
5157 0.036587f, // Mage
5158 0.024211f, // Warlock
5159 0.0f, // ??
5160 0.056097f // Druid
5161 };
5162 // Crit/agility to dodge/agility coefficient multipliers; 3.2.0 increased required agility by 15%
5163 const float crit_to_dodge[MAX_CLASSES] =
5164 {
5165 0.85f / 1.15f, // Warrior
5166 1.00f / 1.15f, // Paladin
5167 1.11f / 1.15f, // Hunter
5168 2.00f / 1.15f, // Rogue
5169 1.00f / 1.15f, // Priest
5170 0.85f / 1.15f, // DK
5171 1.60f / 1.15f, // Shaman
5172 1.00f / 1.15f, // Mage
5173 0.97f / 1.15f, // Warlock (?)
5174 0.0f, // ??
5175 2.00f / 1.15f // Druid
5176 };
5177
5178 uint8 level = GetLevel();
5179 uint32 pclass = getClass();
5180
5181 if (level > GT_MAX_LEVEL)
5182 level = GT_MAX_LEVEL;
5183
5184 // Dodge per agility is proportional to crit per agility, which is available from DBC files
5185 GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5186 if (!dodgeRatio || pclass > MAX_CLASSES)
5187 return;
5188
5191 float bonus_agility = GetStat(STAT_AGILITY) - base_agility;
5192
5193 // calculate diminishing (green in char screen) and non-diminishing (white) contribution
5194 diminishing = 100.0f * bonus_agility * dodgeRatio->ratio * crit_to_dodge[pclass - 1];
5195 nondiminishing = 100.0f * (dodge_base[pclass - 1] + base_agility * dodgeRatio->ratio * crit_to_dodge[pclass - 1]);
5196}
DBCStorage< GtChanceToMeleeCritEntry > sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt)
#define MAX_CLASSES
Definition SharedDefines.h:155
@ UNIT_MOD_STAT_START
Definition Unit.h:171
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition Unit.h:2092
float GetCreateStat(Stats stat) const
Definition Unit.h:1002
Definition DBCStructure.h:1058
float ratio
Definition DBCStructure.h:1059

References BASE_PCT, Unit::getClass(), Unit::GetCreateStat(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, Unit::m_auraModifiersGroup, MAX_CLASSES, GtChanceToMeleeCritEntry::ratio, sGtChanceToMeleeCritStore, STAT_AGILITY, and UNIT_MOD_STAT_START.

Referenced by UpdateDodgePercentage().

◆ GetDrunkenstateByValue()

DrunkenState Player::GetDrunkenstateByValue ( uint8  value)
static
971{
972 if (value >= 90)
973 return DRUNKEN_SMASHED;
974 if (value >= 50)
975 return DRUNKEN_DRUNK;
976 if (value)
977 return DRUNKEN_TIPSY;
978 return DRUNKEN_SOBER;
979}
@ DRUNKEN_TIPSY
Definition Player.h:471
@ DRUNKEN_DRUNK
Definition Player.h:472
@ DRUNKEN_SOBER
Definition Player.h:470
@ DRUNKEN_SMASHED
Definition Player.h:473

References DRUNKEN_DRUNK, DRUNKEN_SMASHED, DRUNKEN_SOBER, and DRUNKEN_TIPSY.

Referenced by Condition::Meets(), AchievementCriteriaData::Meets(), and SetDrunkValue().

◆ GetDrunkValue()

◆ GetDungeonDifficulty()

◆ GetEntryPoint()

WorldLocation const & Player::GetEntryPoint ( ) const
inline

◆ GetExpertiseDodgeOrParryReduction()

float Player::GetExpertiseDodgeOrParryReduction ( WeaponAttackType  attType) const
5237{
5238 switch (attType)
5239 {
5240 case BASE_ATTACK:
5241 return m_Expertise / 4.0f;
5242 case OFF_ATTACK:
5243 return m_OffhandExpertise / 4.0f;
5244 default:
5245 break;
5246 }
5247 return 0.0f;
5248}
float m_OffhandExpertise
Definition Player.h:2898
float m_Expertise
Definition Player.h:2897

References BASE_ATTACK, m_Expertise, m_OffhandExpertise, and OFF_ATTACK.

◆ GetFakeDrunkValue()

int32 Player::GetFakeDrunkValue ( ) const
inline
@ PLAYER_FAKE_INEBRIATION
Definition UpdateFields.h:325
int32 GetInt32Value(uint16 index) const
Definition Object.cpp:288

References Object::GetInt32Value(), and PLAYER_FAKE_INEBRIATION.

Referenced by UpdateInvisibilityDrunkDetect().

◆ GetFarSightDistance()

Optional< float > Player::GetFarSightDistance ( ) const
16248{
16249 return _farSightDistance;
16250}
Optional< float > _farSightDistance
Definition Player.h:3024

References _farSightDistance.

◆ GetFreeInventorySpace()

uint32 Player::GetFreeInventorySpace ( ) const
467{
468 uint32 freeSpace = 0;
469
470 // Check backpack
471 for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; ++slot)
472 {
474 if (!item)
475 freeSpace += 1;
476 }
477
478 // Check bags
480 {
481 if (Bag* bag = GetBagByPos(i))
482 freeSpace += bag->GetFreeSlots();
483 }
484
485 return freeSpace;
486}

References GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::CheckItems().

◆ GetFreePrimaryProfessionPoints()

uint32 Player::GetFreePrimaryProfessionPoints ( ) const
inline

◆ GetFreeTalentPoints()

uint32 Player::GetFreeTalentPoints ( ) const
inline
@ PLAYER_CHARACTER_POINTS1
Definition UpdateFields.h:342

References Object::GetUInt32Value(), and PLAYER_CHARACTER_POINTS1.

Referenced by BuildPlayerTalentsInfoData(), and LearnTalent().

◆ GetGameObjectIfCanInteractWith()

GameObject * Player::GetGameObjectIfCanInteractWith ( ObjectGuid  guid,
GameobjectTypes  type 
) const
2147{
2148 if (GameObject* go = GetMap()->GetGameObject(guid))
2149 {
2150 if (go->GetGoType() == type)
2151 {
2152 // Players cannot interact with gameobjects that use the "Point" icon
2153 if (go->GetGOInfo()->IconName == "Point")
2154 {
2155 return nullptr;
2156 }
2157
2158 if (go->IsWithinDistInMap(this))
2159 {
2160 return go;
2161 }
2162
2163 LOG_DEBUG("maps", "IsGameObjectOfTypeInRange: GameObject '{}' [{}] is too far away from player {} [{}] to be used by him (distance={}, maximal 10 is allowed)",
2164 go->GetGOInfo()->name, go->GetGUID().ToString(), GetName(), GetGUID().ToString(), go->GetDistance(this));
2165 }
2166 }
2167 return nullptr;
2168}
GameObject * GetGameObject(uint32 spellId) const
Definition Unit.cpp:6256

References Unit::GetGameObject(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetName(), LOG_DEBUG, and Position::ToString().

Referenced by CanInteractWithQuestGiver(), WorldSession::CanOpenMailBox(), and WorldSession::HandleGuildBankerActivate().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & Player::GetGlobalCooldownMgr ( )
inline

◆ GetGlyph()

◆ GetGlyphSlot()

uint32 Player::GetGlyphSlot ( uint8  slot) const
inline
@ PLAYER_FIELD_GLYPH_SLOTS_1
Definition UpdateFields.h:388

References Object::GetUInt32Value(), and PLAYER_FIELD_GLYPH_SLOTS_1.

Referenced by _LoadGlyphAuras(), and Spell::EffectApplyGlyph().

◆ GetGossipTextId() [1/2]

uint32 Player::GetGossipTextId ( uint32  menuId,
WorldObject source 
)
405{
407
408 if (!menuId)
409 return textId;
410
411 GossipMenusMapBounds menuBounds = sObjectMgr->GetGossipMenusMapBounds(menuId);
412
413 for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
414 {
415 if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
416 textId = itr->second.TextID;
417 }
418
419 return textId;
420}
#define DEFAULT_GOSSIP_MESSAGE
Definition GossipDef.h:31
std::pair< GossipMenusContainer::const_iterator, GossipMenusContainer::const_iterator > GossipMenusMapBounds
Definition ObjectMgr.h:631

References DEFAULT_GOSSIP_MESSAGE, sConditionMgr, and sObjectMgr.

Referenced by GetGossipTextId(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), boss_gloomrel::OnGossipHello(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_zulaman_hostage::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_high_overlord_saurfang_icc::OnGossipHello(), npc_muradin_bronzebeard_icc::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_adventurous_dwarf::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_drake_dealer_hurlunk::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_zephyr::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_engineering_tele_trinket::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), npc_sayge::OnGossipHello(), npc_wormhole::OnGossipHello(), npc_locksmith::OnGossipHello(), npc_experience::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), icecrown_citadel_teleport::OnGossipHello(), npc_prof_blacksmith::SendActionMenu(), npc_prof_alchemy::SendConfirmLearn(), npc_prof_blacksmith::SendConfirmLearn(), npc_prof_tailor::SendConfirmLearn(), go_evil_book_for_dummies::SendConfirmLearn(), npc_prof_alchemy::SendConfirmUnlearn(), npc_prof_blacksmith::SendConfirmUnlearn(), npc_prof_tailor::SendConfirmUnlearn(), go_evil_book_for_dummies::SendConfirmUnlearn(), SendPreparedGossip(), SendPreparedQuest(), npc_echo_of_medivh::sGossipHello(), and npc_chesspiece::sGossipHello().

◆ GetGossipTextId() [2/2]

uint32 Player::GetGossipTextId ( WorldObject source)
397{
398 if (!source)
400
401 return GetGossipTextId(GetDefaultGossipMenuForSource(source), source);
402}
static uint32 GetDefaultGossipMenuForSource(WorldObject *source)
Definition PlayerGossip.cpp:422
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition PlayerGossip.cpp:404

References DEFAULT_GOSSIP_MESSAGE, GetDefaultGossipMenuForSource(), and GetGossipTextId().

◆ GetGracePeriod()

uint32 Player::GetGracePeriod ( uint8  index) const
inline
2526{ return m_runes->runes[index].GracePeriod; }
uint32 GracePeriod
Definition Player.h:427

References RuneInfo::GracePeriod, m_runes, and Runes::runes.

Referenced by GetRuneBaseCooldown(), and RegenerateAll().

◆ GetGrantableLevels()

uint8 Player::GetGrantableLevels ( )
inline

◆ GetGroup() [1/2]

Group * Player::GetGroup ( )
inline
2485{ return m_group.getTarget(); }
GroupReference m_group
Definition Player.h:2916
TO * getTarget() const
Definition Reference.h:95

References Reference< TO, FROM >::getTarget(), and m_group.

Referenced by _LoadGroup(), Group::AddInvite(), Loot::AddItem(), Group::AddMember(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), Battleground::AddOrSetPlayerToCorrectBgGroup(), Arena::AddPlayer(), InstanceMap::AddPlayerToMap(), LootItem::AllowedForPlayer(), Group::BroadcastPacket(), npc_coren_direbrew::CanBeSeen(), go_loosely_turned_soil::go_loosely_turned_soilAI::CanBeSeen(), InstanceMap::CannotEnter(), CanRollForItemInLFG(), CanUninviteFromGroup(), Spell::CheckCast(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), CheckInstanceLoginValid(), MapInstanced::CreateInstance(), MapInstanced::CreateInstanceForPlayer(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), ArenaTeam::DelMember(), Group::Disband(), WorldSession::DoLootRelease(), DoRandomRoll(), SmartAI::EndPath(), Loot::FillLoot(), GetNextRandomRaidMember(), Unit::GetNextRandomRaidMemberOrPet(), Unit::GetPartyMembers(), ChatHandler::GetPlayerGroupAndGUIDByName(), GetsRecruitAFriendBonus(), GroupEventHappens(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), Unit::HandleAuraRaidProcFromChargeWithValue(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), Unit::HandleDummyAuraProc(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupAssistantLeaderOpcode(), WorldSession::HandleGroupChangeSubGroupOpcode(), WorldSession::HandleGroupDisbandOpcode(), WorldSession::HandleGroupInviteOpcode(), group_commandscript::HandleGroupJoinCommand(), WorldSession::HandleGroupRaidConvertOpcode(), group_commandscript::HandleGroupReviveCommand(), WorldSession::HandleGroupSetLeaderOpcode(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleGroupSwapSubGroupOpcode(), WorldSession::HandleGroupUninviteGuidOpcode(), WorldSession::HandleGroupUninviteOpcode(), WorldSession::HandleInstanceLockResponse(), OutdoorPvP::HandleKill(), OutdoorPvPNA::HandleKill(), WorldSession::HandleLfgLeaveOpcode(), WorldSession::HandleLfgPartyLockInfoRequestOpcode(), WorldSession::HandleLfgSetRolesOpcode(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandleLootMethodOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleLootRoll(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMinimapPingOpcode(), WorldSession::HandlePartyAssignmentOpcode(), WorldSession::HandlePetRename(), Battlefield::HandlePlayerLeaveZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleRaidReadyCheckFinishedOpcode(), WorldSession::HandleRaidReadyCheckOpcode(), WorldSession::HandleRaidTargetUpdateOpcode(), WorldSession::HandleResetInstancesOpcode(), WorldSession::HandleSetDungeonDifficultyOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), misc_commandscript::HandleSummonCommand(), tele_commandscript::HandleTeleGroupCommand(), HasQuestForGO(), HasQuestForItem(), isAllowedToLoot(), SmartAI::IsEscortInvokerInRange(), Unit::IsInPartyWith(), IsInSameGroupWith(), IsInSameRaidWith(), GameObject::IsLootAllowedFor(), Creature::isTappedBy(), lfg::LFGMgr::JoinLfg(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), npc_coren_direbrew::JustDied(), boss_headless_horseman::JustDied(), boss_ahune::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), Unit::Kill(), KilledMonsterCredit(), KilledPlayerCredit(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), lfg::LFGMgr::MakeNewGroup(), npc_icc_buff_switcher::OnGossipSelect(), lfg::LFGPlayerScript::OnPlayerBindToInstance(), lfg::LFGPlayerScript::OnPlayerLevelChanged(), lfg::LFGPlayerScript::OnPlayerLogin(), lfg::LFGPlayerScript::OnPlayerLogout(), lfg::LFGPlayerScript::OnPlayerMapChanged(), Acore::MostHPMissingGroupInRange::operator()(), InstanceMap::PermBindAllPlayers(), MapMgr::PlayerCannotEnter(), InstanceSaveMgr::PlayerGetDestinationInstanceId(), ProcessDelayedOperations(), RemoveFromGroup(), RemovePet(), RewardPlayerAndGroupAtEvent(), Group::SameSubGroup(), Satisfy(), SendInitialPacketsAfterAddToMap(), SendLoot(), SendNewItem(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), SendUpdateToOutOfRangeGroupMembers(), Group::SendUpdateToPlayer(), SetBattlegroundOrBattlefieldRaid(), Unit::SetHealth(), Creature::SetLootRecipient(), Unit::SetMaxHealth(), Unit::SetMaxPower(), Unit::SetPower(), Unit::setPowerType(), StoreLootItem(), lfg::LFGMgr::TeleportPlayer(), PetAI::UpdateAllies(), Unit::UpdateAuraForGroup(), UpdatePosition(), lfg::LFGMgr::UpdateRaidBrowser(), UpdateZone(), and GameObject::Use().

◆ GetGroup() [2/2]

const Group * Player::GetGroup ( ) const
inline
2486{ return (const Group*)m_group.getTarget(); }

References Reference< TO, FROM >::getTarget(), and m_group.

◆ GetGroupInvite()

◆ GetGroupRef()

GroupReference & Player::GetGroupRef ( )
inline
2487{ return m_group; }

References m_group.

◆ GetGroupUpdateFlag()

uint32 Player::GetGroupUpdateFlag ( ) const
inline

◆ GetGuild()

Guild * Player::GetGuild ( ) const
15973{
15974 uint32 guildId = GetGuildId();
15975 return guildId ? sGuildMgr->GetGuildById(guildId) : nullptr;
15976}

References GetGuildId(), and sGuildMgr.

Referenced by GiveLevel(), WorldSession::HandleGuildBankerActivate(), WorldSession::HandleGuildBankSwapItems(), WorldSession::HandleGuildRankOpcode(), Guild::HandleInviteMember(), and UpdateZone().

◆ GetGuildId()

◆ GetGuildIdInvited()

◆ GetGuildName()

std::string const & Player::GetGuildName ( )
15312{
15313 return sGuildMgr->GetGuildById(GetGuildId())->GetName();
15314}

References GetGuildId(), and sGuildMgr.

◆ GetHealthBonusFromStamina()

float Player::GetHealthBonusFromStamina ( )
294{
295 float stamina = GetStat(STAT_STAMINA);
296
297 float baseStam = stamina < 20 ? stamina : 20;
298 float moreStam = stamina - baseStam;
299
300 return baseStam + (moreStam * 10.0f);
301}

References Unit::GetStat(), and STAT_STAMINA.

Referenced by UpdateMaxHealth().

◆ GetHonorPoints()

◆ GetInGameTime()

uint32 Player::GetInGameTime ( )
inline
1566{ return m_ingametime; }

References m_ingametime.

◆ GetInitialVisiblePackets()

void Player::GetInitialVisiblePackets ( Unit target)
1709{
1710 GetAurasForTarget(target);
1711 if (target->IsAlive())
1712 {
1714 target->GetVictim())
1715 target->SendMeleeAttackStart(target->GetVictim(), this);
1716 }
1717}
@ UNIT_STATE_MELEE_ATTACKING
Definition UnitDefines.h:171
void GetAurasForTarget(Unit *target, bool force=false)
Definition Player.cpp:12029
Unit * GetVictim() const
Definition Unit.h:848
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition Unit.cpp:3089

References GetAurasForTarget(), Unit::GetVictim(), Unit::HasUnitState(), Unit::IsAlive(), Unit::SendMeleeAttackStart(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by Acore::VisibleNotifier::SendToSelf(), and UpdateVisibilityOf().

◆ GetInnTriggerId()

uint32 Player::GetInnTriggerId ( ) const
inline
1222{ return _innTriggerId; }

References _innTriggerId.

Referenced by Update().

◆ GetItemByEntry()

Item * Player::GetItemByEntry ( uint32  entry) const
3370{
3371 // in inventory
3373 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3374 if (pItem->GetEntry() == entry)
3375 return pItem;
3376
3378 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3379 if (pItem->GetEntry() == entry)
3380 return pItem;
3381
3382 for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
3383 if (Bag* pBag = GetBagByPos(i))
3384 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
3385 if (Item* pItem = pBag->GetItemByPos(j))
3386 if (pItem->GetEntry() == entry)
3387 return pItem;
3388
3389 for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i)
3390 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3391 if (pItem->GetEntry() == entry)
3392 return pItem;
3393
3394 return nullptr;
3395}

References CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and KEYRING_SLOT_START.

Referenced by Spell::CheckItems(), Spell::EffectRechargeManaGem(), and Spell::EffectStuck().

◆ GetItemByGuid()

Item * Player::GetItemByGuid ( ObjectGuid  guid) const
408{
410 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
411 if (pItem->GetGUID() == guid)
412 return pItem;
413
415 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
416 if (pItem->GetGUID() == guid)
417 return pItem;
418
419 for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
420 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
421 if (pItem->GetGUID() == guid)
422 return pItem;
423
425 if (Bag* pBag = GetBagByPos(i))
426 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
427 if (Item* pItem = pBag->GetItemByPos(j))
428 if (pItem->GetGUID() == guid)
429 return pItem;
430
432 if (Bag* pBag = GetBagByPos(i))
433 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
434 if (Item* pItem = pBag->GetItemByPos(j))
435 if (pItem->GetGUID() == guid)
436 return pItem;
437
438 return nullptr;
439}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and KEYRING_SLOT_START.

Referenced by _SaveInventory(), Spell::CheckCast(), WorldSession::DoLootRelease(), TradeData::GetItem(), TradeData::GetSpellCastItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleAutoEquipItemSlotOpcode(), WorldSession::HandleAutostoreLootItemOpcode(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugItemExpireCommand(), debug_commandscript::HandleDebugSetItemValueCommand(), Unit::HandleDummyAuraProc(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleItemRefund(), WorldSession::HandleItemRefundInfoRequest(), WorldSession::HandleItemTextQuery(), WorldSession::HandleLootMoneyOpcode(), Unit::HandleOverrideClassScriptAuraProc(), WorldSession::HandlePetitionRenameOpcode(), Unit::HandleProcTriggerSpell(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleSocketOpcode(), WorldSession::HandleTurnInPetitionOpcode(), SendLoot(), SpellCastTargets::Update(), and Spell::UpdatePointers().

◆ GetItemByPos() [1/2]

Item * Player::GetItemByPos ( uint16  pos) const
442{
443 uint8 bag = pos >> 8;
444 uint8 slot = pos & 255;
445 return GetItemByPos(bag, slot);
446}

References GetItemByPos().

Referenced by _SaveCharacter(), _SaveInventory(), _StoreItem(), AutoUnequipOffhandIfNeed(), BuildEnchantmentsInfoData(), CanEquipItem(), CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanStoreItems(), CanUnequipItem(), CanUnequipItems(), CastItemCombatSpell(), CorrectMetaGemEnchants(), Create(), DestroyConjuredItems(), DestroyItem(), DestroyItemCount(), DestroyZoneLimitedItem(), DurabilityLossAll(), DurabilityPointLossForEquipSlot(), DurabilityPointsLossAll(), DurabilityRepair(), Spell::EffectDurabilityDamage(), Spell::EffectDurabilityDamagePCT(), Spell::EffectEnchantHeldItem(), EnchantmentFitsRequirements(), EquipItem(), EquippedOk(), FindEquipSlot(), GetBagByPos(), GetFreeInventorySpace(), GetItemByEntry(), GetItemByGuid(), GetItemByPos(), GetItemCount(), GetItemCountWithLimitCategory(), GetShield(), GetUseableItemByPos(), GetWeaponForAttack(), misc_commandscript::HandleAddItemCommand(), spell_rog_deadly_poison::HandleAfterHit(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModShapeshift(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), bg_commandscript::HandleBagsClearCommand(), WorldSession::HandleCancelTempEnchantmentOpcode(), character_commandscript::HandleCharacterCheckBagCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetSave(), WorldSession::HandleEquipmentSetUse(), inventory_commandscript::HandleInventoryCountCommand(), WorldSession::HandleMirrorImageDataRequest(), WorldSession::HandleOpenItemOpcode(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleReadItem(), WorldSession::HandleSetTradeItemOpcode(), WorldSession::HandleWrapItemOpcode(), HasItemCount(), HasItemOrGemWithIdEquipped(), HasItemOrGemWithLimitCategoryEquipped(), HasItemTotemCategory(), IsTwoHandUsed(), MoveItemFromInventory(), RemoveArenaEnchantments(), RemoveItem(), reset_commandscript::ResetItemsDeleteBankBags(), reset_commandscript::ResetItemsDeleteStandardBags(), reset_commandscript::ResetItemsEquipped(), reset_commandscript::ResetItemsInBags(), reset_commandscript::ResetItemsInBank(), reset_commandscript::ResetItemsInCurrenciesList(), reset_commandscript::ResetItemsInKeyring(), SplitItem(), SwapItem(), and ToggleMetaGemsActive().

◆ GetItemByPos() [2/2]

Item * Player::GetItemByPos ( uint8  bag,
uint8  slot 
) const
449{
450 if (bag == INVENTORY_SLOT_BAG_0 && (slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)))
451 return m_items[slot];
452 else if (Bag* pBag = GetBagByPos(bag))
453 return pBag->GetItemByPos(slot);
454 return nullptr;
455}

References BANK_SLOT_BAG_END, CURRENCYTOKEN_SLOT_END, GetBagByPos(), INVENTORY_SLOT_BAG_0, KEYRING_SLOT_START, and m_items.

◆ GetItemCount()

uint32 Player::GetItemCount ( uint32  item,
bool  inBankAlso = false,
Item skipItem = nullptr 
) const
328{
329 uint32 count = 0;
331 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
332 if (pItem != skipItem && pItem->GetEntry() == item)
333 count += pItem->GetCount();
334
336 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
337 if (pItem != skipItem && pItem->GetEntry() == item)
338 count += pItem->GetCount();
339
341 if (Bag* pBag = GetBagByPos(i))
342 count += pBag->GetItemCount(item, skipItem);
343
344 if (skipItem && skipItem->GetTemplate()->GemProperties)
346 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
347 if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
348 count += pItem->GetGemCountWithID(item);
349
350 if (inBankAlso)
351 {
352 // checking every item from 39 to 74 (including bank bags)
354 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
355 if (pItem != skipItem && pItem->GetEntry() == item)
356 count += pItem->GetCount();
357
359 if (Bag* pBag = GetBagByPos(i))
360 count += pBag->GetItemCount(item, skipItem);
361
362 if (skipItem && skipItem->GetTemplate()->GemProperties)
364 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
365 if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
366 count += pItem->GetGemCountWithID(item);
367 }
368
369 return count;
370}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, _Socket::Color, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, ItemTemplate::GemProperties, GetBagByPos(), Object::GetEntry(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, KEYRING_SLOT_START, and ItemTemplate::Socket.

Referenced by AdjustQuestReqItemCount(), CanRewardQuest(), CanRollOnItem(), CanTakeMoreSimilarItems(), WorldSession::HandleSetAmmoOpcode(), HasQuestForItem(), npc_venomhide_hatchling::npc_venomhide_hatchlingAI::IsSummonedBy(), ItemRemovedQuestCheck(), npc_adventurous_dwarf::OnGossipHello(), SendNewItem(), and PlayerMenu::SendQuestGiverRequestItems().

◆ GetItemCountWithLimitCategory()

uint32 Player::GetItemCountWithLimitCategory ( uint32  limitCategory,
Item skipItem = nullptr 
) const
373{
374 uint32 count = 0;
375 for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
376 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
377 if (pItem != skipItem)
378 if (ItemTemplate const* pProto = pItem->GetTemplate())
379 if (pProto->ItemLimitCategory == limitCategory)
380 count += pItem->GetCount();
381
382 for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
383 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
384 if (pItem != skipItem)
385 if (ItemTemplate const* pProto = pItem->GetTemplate())
386 if (pProto->ItemLimitCategory == limitCategory)
387 count += pItem->GetCount();
388
390 if (Bag* pBag = GetBagByPos(i))
391 count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem);
392
393 for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
394 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
395 if (pItem != skipItem)
396 if (ItemTemplate const* pProto = pItem->GetTemplate())
397 if (pProto->ItemLimitCategory == limitCategory)
398 count += pItem->GetCount();
399
400 for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
401 if (Bag* pBag = GetBagByPos(i))
402 count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem);
403
404 return count;
405}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and KEYRING_SLOT_START.

Referenced by CanTakeMoreSimilarItems().

◆ GetItemFromBuyBackSlot()

Item * Player::GetItemFromBuyBackSlot ( uint32  slot)
3988{
3989 LOG_DEBUG("entities.player.items", "STORAGE: GetItemFromBuyBackSlot slot = {}", slot);
3990 if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END)
3991 return m_items[slot];
3992 return nullptr;
3993}

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, LOG_DEBUG, and m_items.

Referenced by WorldSession::HandleBuybackItem(), and reset_commandscript::ResetItemsInVendorBuyBackTab().

◆ GetItemUpdateQueue()

std::vector< Item * > & Player::GetItemUpdateQueue ( )
inline

◆ GetLastPetNumber()

uint32 Player::GetLastPetNumber ( ) const
inline
2474{ return m_lastpetnumber; }

References m_lastpetnumber.

Referenced by spell_gen_pet_summoned::HandleScript().

◆ GetLastPetSpell()

uint32 Player::GetLastPetSpell ( ) const
inline

◆ GetLastPotionId()

uint32 Player::GetLastPotionId ( )
inline
1825{ return m_lastPotionId; }

References m_lastPotionId.

Referenced by Spell::CheckCast(), and UpdatePotionCooldown().

◆ GetLastUsedRune()

RuneType Player::GetLastUsedRune ( )
inline
2529{ return m_runes->lastUsedRune; }
RuneType lastUsedRune
Definition Player.h:435

References Runes::lastUsedRune, and m_runes.

◆ GetLevelPlayedTime()

uint32 Player::GetLevelPlayedTime ( )
inline

◆ GetLootGUID()

◆ GetMail()

Mail * Player::GetMail ( uint32  id)
3831{
3832 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
3833 {
3834 if ((*itr)->messageID == id)
3835 {
3836 return (*itr);
3837 }
3838 }
3839 return nullptr;
3840}

References m_mail.

Referenced by WorldSession::HandleMailCreateTextItem(), WorldSession::HandleMailDelete(), WorldSession::HandleMailMarkAsRead(), WorldSession::HandleMailReturnToSender(), WorldSession::HandleMailTakeItem(), and WorldSession::HandleMailTakeMoney().

◆ GetMails()

PlayerMails const & Player::GetMails ( ) const
inline

◆ GetMailSize()

uint32 Player::GetMailSize ( )
inline
1662{ return m_mail.size();}

References m_mail.

Referenced by _SaveMail(), and WorldSession::HandleSendMail().

◆ GetManaBonusFromIntellect()

float Player::GetManaBonusFromIntellect ( )
304{
305 float intellect = GetStat(STAT_INTELLECT);
306
307 float baseInt = intellect < 20 ? intellect : 20;
308 float moreInt = intellect - baseInt;
309
310 return baseInt + (moreInt * 15.0f);
311}

References Unit::GetStat(), and STAT_INTELLECT.

Referenced by UpdateMaxPower().

◆ GetMapRef()

MapReference & Player::GetMapRef ( )
inline
2508{ return m_mapRef; }
MapReference m_mapRef
Definition Player.h:2971

References m_mapRef.

Referenced by InstanceMap::CannotEnter(), BattlegroundMap::CannotEnter(), ResetMap(), and Map::UpdateIteratorBack().

◆ GetMaxKeyringSize()

uint32 Player::GetMaxKeyringSize ( ) const
inline

◆ GetMaxPersonalArenaRatingRequirement()

uint32 Player::GetMaxPersonalArenaRatingRequirement ( uint32  minarenaslot) const

If trans is specified, arena point save query will be added to trans.

10866{
10867 // returns the maximal personal arena rating that can be used to purchase items requiring this condition
10868 // the personal rating of the arena team must match the required limit as well
10869 // so return max[in arenateams](min(personalrating[teamtype], teamrating[teamtype]))
10870 uint32 max_personal_rating = 0;
10871 for (uint8 i = minarenaslot; i < MAX_ARENA_SLOT; ++i)
10872 {
10873 if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamId(i)))
10874 {
10875 uint32 p_rating = GetArenaPersonalRating(i);
10876 uint32 t_rating = at->GetRating();
10877 p_rating = p_rating < t_rating ? p_rating : t_rating;
10878 if (max_personal_rating < p_rating)
10879 max_personal_rating = p_rating;
10880 }
10881 }
10882
10883 sScriptMgr->OnPlayerGetMaxPersonalArenaRatingRequirement(this, minarenaslot, max_personal_rating);
10884
10885 return max_personal_rating;
10886}
uint32 GetArenaPersonalRating(uint8 slot) const
Definition Player.cpp:16169
uint32 GetArenaTeamId(uint8 slot) const
Definition Player.cpp:16178

References GetArenaPersonalRating(), GetArenaTeamId(), MAX_ARENA_SLOT, sArenaTeamMgr, and sScriptMgr.

Referenced by BuyItemFromVendorSlot().

◆ GetMaxSkillValue()

uint16 Player::GetMaxSkillValue ( uint32  skill) const
5501{
5502 if (!skill)
5503 return 0;
5504
5505 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5506 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5507 return 0;
5508
5509 uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
5510
5511 int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5512 sScriptMgr->OnPlayerGetMaxSkillValue(const_cast<Player*>(this), skill, result, false);
5513 result += SKILL_TEMP_BONUS(bonus);
5514 result += SKILL_PERM_BONUS(bonus);
5515 return result < 0 ? 0 : result;
5516}
#define SKILL_TEMP_BONUS(x)
Definition Player.h:86

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_MAX, SKILL_PERM_BONUS, SKILL_TEMP_BONUS, and sScriptMgr.

Referenced by Unit::GetDefenseSkillValue(), and UpdateFishingSkill().

◆ GetMaxSkillValueForLevel()

uint16 Player::GetMaxSkillValueForLevel ( ) const
16206{
16208
16209 sScriptMgr->OnPlayerGetMaxSkillValueForLevel(const_cast<Player*>(this), result);
16210
16211 return result;
16212}
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition Unit.h:1132

References Unit::GetMaxSkillValueForLevel(), and sScriptMgr.

Referenced by _addSpell(), _LoadSkills(), GetMissPercentageFromDefence(), LearnDefaultSkill(), removeSpell(), UpdateBlockPercentage(), UpdateCritPercentage(), UpdateDodgePercentage(), UpdateParryPercentage(), and UpdateSkillsForLevel().

◆ getMaxTimer()

int32 Player::getMaxTimer ( MirrorTimerType  timer)
protected
818{
819 switch (timer)
820 {
821 case FATIGUE_TIMER:
822 return MINUTE * IN_MILLISECONDS;
823 case BREATH_TIMER:
824 {
827 int32 UnderWaterTime = sWorld->getIntConfig(CONFIG_WATER_BREATH_TIMER);
829 for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
830 AddPct(UnderWaterTime, (*i)->GetAmount());
831 return UnderWaterTime;
832 }
833 case FIRE_TIMER:
834 {
835 if (!IsAlive())
837 return 2020;
838 }
839 default:
840 return 0;
841 }
842}
AccountTypes
Definition Common.h:56
@ FIRE_TIMER
Definition Player.h:582
@ FATIGUE_TIMER
Definition Player.h:580
@ BREATH_TIMER
Definition Player.h:581
@ SPELL_AURA_MOD_WATER_BREATHING
Definition SpellAuraDefines.h:218
@ CONFIG_WATER_BREATH_TIMER
Definition WorldConfig.h:375
@ CONFIG_DISABLE_BREATHING
Definition WorldConfig.h:256
bool HasWaterBreathingAura() const
Definition Unit.h:1725

References AddPct(), BREATH_TIMER, CONFIG_DISABLE_BREATHING, CONFIG_WATER_BREATH_TIMER, DISABLED_MIRROR_TIMER, FATIGUE_TIMER, FIRE_TIMER, Unit::GetAuraEffectsByType(), GetSession(), Unit::HasWaterBreathingAura(), IN_MILLISECONDS, Unit::IsAlive(), MINUTE, SPELL_AURA_MOD_WATER_BREATHING, and sWorld.

Referenced by HandleDrowning(), and IsMirrorTimerActive().

◆ GetMeleeCritFromAgility()

float Player::GetMeleeCritFromAgility ( )
5129{
5130 uint8 level = GetLevel();
5131 uint32 pclass = getClass();
5132
5133 if (level > GT_MAX_LEVEL)
5134 level = GT_MAX_LEVEL;
5135
5136 GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1);
5137 GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5138 if (!critBase || !critRatio)
5139 return 0.0f;
5140
5141 float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio;
5142 return crit * 100.0f;
5143}
DBCStorage< GtChanceToMeleeCritBaseEntry > sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt)
Definition DBCStructure.h:1053
float base
Definition DBCStructure.h:1054

References GtChanceToMeleeCritBaseEntry::base, Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtChanceToMeleeCritEntry::ratio, sGtChanceToMeleeCritBaseStore, sGtChanceToMeleeCritStore, and STAT_AGILITY.

Referenced by UpdateAllCritPercentages().

◆ GetMeleeDamageSchoolMask()

SpellSchoolMask Player::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
overridevirtual

Implements Unit.

7021{
7022 if (Item const* weapon = GetWeaponForAttack(attackType, true))
7023 {
7024 return SpellSchoolMask(1 << weapon->GetTemplate()->Damage[damageIndex].DamageType);
7025 }
7026
7028}
SpellSchoolMask
Definition SharedDefines.h:295

References GetWeaponForAttack(), and SPELL_SCHOOL_MASK_NORMAL.

◆ GetMissPercentageFromDefence()

float Player::GetMissPercentageFromDefence ( ) const
726{
727 float const miss_cap[MAX_CLASSES] =
728 {
729 16.00f, // Warrior //correct
730 16.00f, // Paladin //correct
731 16.00f, // Hunter //?
732 16.00f, // Rogue //?
733 16.00f, // Priest //?
734 16.00f, // DK //correct
735 16.00f, // Shaman //?
736 16.00f, // Mage //?
737 16.00f, // Warlock //?
738 0.0f, // ??
739 16.00f // Druid //?
740 };
741
742 float diminishing = 0.0f, nondiminishing = 0.0f;
743 // Modify value from defense skill (only bonus from defense rating diminishes)
744 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
745 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
746
747 // apply diminishing formula to diminishing miss chance
748 uint32 pclass = getClass() - 1;
749 return nondiminishing + (diminishing * miss_cap[pclass] / (diminishing + miss_cap[pclass] * m_diminishing_k[pclass]));
750}
const float m_diminishing_k[MAX_CLASSES]
Definition StatSystem.cpp:710
float GetRatingBonusValue(CombatRating cr) const
Definition Player.cpp:5231

References CR_DEFENSE_SKILL, Unit::getClass(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), m_diminishing_k, MAX_CLASSES, and SKILL_DEFENSE.

◆ GetMItem()

Item * Player::GetMItem ( ObjectGuid::LowType  itemLowGuid)
inline
1681 {
1682 ItemMap::const_iterator itr = mMitems.find(itemLowGuid);
1683 return itr != mMitems.end() ? itr->second : nullptr;
1684 }

References mMitems.

Referenced by WorldSession::HandleGetMailList(), WorldSession::HandleMailReturnToSender(), and WorldSession::HandleMailTakeItem().

◆ GetMoney()

◆ GetMostPointsTalentTree()

uint8 Player::GetMostPointsTalentTree ( ) const
15271{
15272 uint32 specPoints[3] = {0, 0, 0};
15273 const PlayerTalentMap& talentMap = GetTalentMap();
15274 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
15275 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec()))
15276 if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID))
15277 if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab))
15278 if (tab->tabpage < 3)
15279 {
15280 // find current talent rank
15281 uint8 currentTalentRank = 0;
15282 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
15283 if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank])
15284 {
15285 currentTalentRank = rank + 1;
15286 break;
15287 }
15288 specPoints[tab->tabpage] += currentTalentRank;
15289 }
15290 uint8 maxIndex = 0;
15291 uint8 maxCount = specPoints[0];
15292 for (uint8 i = 1; i < 3; ++i)
15293 if (specPoints[i] > maxCount)
15294 {
15295 maxIndex = i;
15296 maxCount = specPoints[i];
15297 }
15298 return maxIndex;
15299}

References GetActiveSpec(), GetTalentMap(), MAX_TALENT_RANK, PLAYERSPELL_REMOVED, sTalentStore, and sTalentTabStore.

◆ GetMountBlockId()

uint32 Player::GetMountBlockId ( )
inline

◆ GetNextQuest()

Quest const * Player::GetNextQuest ( ObjectGuid  guid,
Quest const *  quest 
)
208{
209 QuestRelationBounds objectQR;
210
212 if (creature)
213 objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
214 else
215 {
216 //we should obtain map pointer from GetMap() in 99% of cases. Special case
217 //only for quests which cast teleport spells on player
219 ASSERT(_map);
220 GameObject* pGameObject = _map->GetGameObject(guid);
221 if (pGameObject)
222 objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
223 else
224 return nullptr;
225 }
226
227 uint32 nextQuestID = quest->GetNextQuestInChain();
228 for (QuestRelations::const_iterator itr = objectQR.first; itr != objectQR.second; ++itr)
229 {
230 if (itr->second == nextQuestID)
231 return sObjectMgr->GetQuestTemplate(nextQuestID);
232 }
233
234 return nullptr;
235}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition ObjectMgr.h:525
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition ObjectAccessor.cpp:234

References ASSERT, ObjectAccessor::GetCreatureOrPetOrVehicle(), Object::GetEntry(), Map::GetGameObject(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), Quest::GetNextQuestInChain(), Object::IsInWorld(), sMapMgr, and sObjectMgr.

Referenced by WorldSession::HandleQuestgiverChooseRewardOpcode().

◆ GetNextRandomRaidMember()

Player * Player::GetNextRandomRaidMember ( float  radius)
12951{
12952 Group* group = GetGroup();
12953 if (!group)
12954 return nullptr;
12955
12956 std::vector<Player*> nearMembers;
12957 nearMembers.reserve(group->GetMembersCount());
12958
12959 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12960 {
12961 Player* Target = itr->GetSource();
12962
12963 // IsHostileTo check duel and controlled by enemy
12964 if (Target && Target != this && IsWithinDistInMap(Target, radius) &&
12965 !Target->HasInvisibilityAura() && !IsHostileTo(Target))
12966 nearMembers.push_back(Target);
12967 }
12968
12969 if (nearMembers.empty())
12970 return nullptr;
12971
12972 uint32 randTarget = urand(0, nearMembers.size() - 1);
12973 return nearMembers[randTarget];
12974}
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:10297

References Group::GetFirstMember(), GetGroup(), Group::GetMembersCount(), Unit::HasInvisibilityAura(), Unit::IsHostileTo(), WorldObject::IsWithinDistInMap(), and urand().

◆ GetNextSave()

uint32 Player::GetNextSave ( ) const
inline
2627{ return m_nextSave; }

References m_nextSave.

◆ GetNPCIfCanInteractWith()

Creature * Player::GetNPCIfCanInteractWith ( ObjectGuid  guid,
uint32  npcflagmask 
)
2090{
2091 // unit checks
2092 if (!guid)
2093 return nullptr;
2094
2095 if (!IsInWorld())
2096 return nullptr;
2097
2098 if (IsInFlight())
2099 return nullptr;
2100
2101 // exist (we need look pets also for some interaction (quest/etc)
2102 Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
2103 if (!creature)
2104 return nullptr;
2105
2106 // Deathstate checks
2108 return nullptr;
2109
2110 // alive or spirit healer
2112 return nullptr;
2113
2114 // appropriate npc type
2115 if (npcflagmask && !creature->HasNpcFlag(NPCFlags(npcflagmask)))
2116 return nullptr;
2117
2118 // not allow interaction under control, but allow with own pets
2119 if (creature->GetCharmerGUID())
2120 return nullptr;
2121
2122 // xinef: perform better check
2123 if (creature->GetReactionTo(this) <= REP_UNFRIENDLY)
2124 return nullptr;
2125
2126 // xinef: not needed, CORRECTLY checked above including forced reputations etc
2127 // not unfriendly
2128 //if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(creature->GetFaction()))
2129 // if (factionTemplate->faction)
2130 // if (FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
2131 // if (faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY)
2132 // return nullptr;
2133
2134 // not too far
2135 if (!creature->IsWithinDistInMap(this, INTERACTION_DISTANCE))
2136 return nullptr;
2137
2138 // pussywizard: many npcs have missing conditions for class training and rogue trainer can for eg. train dual wield to a shaman :/ too many to change in sql and watch in the future
2139 // pussywizard: this function is not used when talking, but when already taking action (buy spell, reset talents, show spell list)
2141 return nullptr;
2142
2143 return creature;
2144}
#define INTERACTION_DISTANCE
Definition ObjectDefines.h:24
Classes
Definition SharedDefines.h:139
@ REP_UNFRIENDLY
Definition SharedDefines.h:182
@ TRAINER_TYPE_CLASS
Definition SharedDefines.h:2617
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
Definition SharedDefines.h:2696
@ CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD
Definition SharedDefines.h:2702
@ CLASS_CONTEXT_CLASS_TRAINER
Definition UnitDefines.h:243
NPCFlags
Non Player Character flags.
Definition UnitDefines.h:313
@ UNIT_NPC_FLAG_TRAINER_CLASS
Definition UnitDefines.h:320
@ UNIT_NPC_FLAG_TRAINER
Definition UnitDefines.h:319
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition Unit.cpp:10125
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:718
ObjectGuid GetCharmerGUID() const
Definition Unit.h:674
uint32 trainer_class
Definition CreatureData.h:220
uint32 type_flags
Definition CreatureData.h:223
uint32 trainer_type
Definition CreatureData.h:218

References CLASS_CONTEXT_CLASS_TRAINER, CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD, CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS, Unit::GetCharmerGUID(), ObjectAccessor::GetCreatureOrPetOrVehicle(), Creature::GetCreatureTemplate(), Unit::GetReactionTo(), Unit::HasNpcFlag(), INTERACTION_DISTANCE, Unit::IsAlive(), IsClass(), Unit::IsInFlight(), Object::IsInWorld(), WorldObject::IsWithinDistInMap(), REP_UNFRIENDLY, CreatureTemplate::trainer_class, CreatureTemplate::trainer_type, TRAINER_TYPE_CLASS, CreatureTemplate::type_flags, UNIT_NPC_FLAG_TRAINER, and UNIT_NPC_FLAG_TRAINER_CLASS.

Referenced by BuyItemFromVendorSlot(), CanInteractWithQuestGiver(), WorldSession::CanOpenMailBox(), WorldSession::CanUseBank(), WorldSession::HandleActivateTaxiExpressOpcode(), WorldSession::HandleActivateTaxiOpcode(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::SendListInventory(), WorldSession::SendPetitionShowList(), and WorldSession::SendTrainerList().

◆ GetOriginalGroup()

◆ GetOriginalGroupRef()

GroupReference & Player::GetOriginalGroupRef ( )
inline
2501{ return m_originalGroup; }

References m_originalGroup.

◆ GetOriginalSubGroup()

uint8 Player::GetOriginalSubGroup ( ) const
inline
2502{ return m_originalGroup.getSubGroup(); }
uint8 getSubGroup() const
Definition GroupReference.h:38

References GroupReference::getSubGroup(), and m_originalGroup.

Referenced by RemoveFromBattlegroundOrBattlefieldRaid().

◆ GetOrInitPetStable()

PetStable & Player::GetOrInitPetStable ( )
15551{
15552 if (!m_petStable)
15553 m_petStable = std::make_unique<PetStable>();
15554
15555 return *m_petStable;
15556}

References m_petStable.

Referenced by WorldSession::HandleBuyStableSlot(), Unit::InitTamedPet(), and SummonPet().

◆ GetOutdoorPvP()

OutdoorPvP * Player::GetOutdoorPvP ( ) const
12483{
12484 return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
12485}
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102

References WorldObject::GetZoneId(), and sOutdoorPvPMgr.

Referenced by WorldSession::HandleAreaTriggerOpcode(), and Unit::Kill().

◆ GetPassOnGroupLoot()

bool Player::GetPassOnGroupLoot ( ) const
inline
2506{ return m_bPassOnGroupLoot; }

References m_bPassOnGroupLoot.

Referenced by Group::GroupLoot(), and Group::NeedBeforeGreed().

◆ GetPendingBind()

uint32 Player::GetPendingBind ( ) const
inline
2457{ return _pendingBindId; }

References _pendingBindId.

Referenced by WorldSession::HandleInstanceLockResponse().

◆ GetPendingSpectatorInviteInstanceId()

uint32 Player::GetPendingSpectatorInviteInstanceId ( ) const
inline

◆ GetPet()

Pet * Player::GetPet ( ) const
8937{
8938 if (ObjectGuid pet_guid = GetPetGUID())
8939 {
8940 if (!pet_guid.IsPet())
8941 return nullptr;
8942
8943 Pet* pet = ObjectAccessor::GetPet(*this, pet_guid);
8944
8945 if (!pet)
8946 return nullptr;
8947
8948 if (IsInWorld())
8949 return pet;
8950
8951 //there may be a guardian in slot
8952 //LOG_ERROR("entities.player", "Player::GetPet: Pet {} not exist.", pet_guid.ToString());
8953 //const_cast<Player*>(this)->SetPetGUID(0);
8954 }
8955
8956 return nullptr;
8957}
Pet * GetPet(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:215

References ObjectAccessor::GetPet(), Unit::GetPetGUID(), and Object::IsInWorld().

Referenced by Spell::_cast(), KillRewarder::_RewardXP(), ActivateSpec(), Battleground::AddPlayer(), AuraEffect::ApplySpellMod(), WorldSession::BuildPartyMemberStatsChangedPacket(), BuildPetTalentsInfoData(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), Unit::DealDamage(), spell_hun_masters_call::DoCheckCast(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::EffectFeedPet(), Spell::EffectResurrectPet(), Spell::EffectSummonPet(), GiveLevel(), AuraEffect::HandleAuraModPetTalentsPoints(), spell_hun_masters_call::HandleDummy(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), AuraEffect::HandleModPossessPet(), WorldSession::HandleMoveTeleportAck(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), Unit::HandleProcTriggerSpell(), WorldSession::HandleRequestPartyMemberStatsOpcode(), WorldSession::HandleRequestPetInfo(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetTalentsCommand(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleUnstablePet(), InitStatsForLevel(), Unit::Kill(), LearnPetTalent(), Pet::LoadPetFromDB(), go_orb_of_domination::OnGossipHello(), PetSpellInitialize(), PrepareGossipMenu(), RemoveArenaSpellCooldowns(), RemovePet(), ResetPetTalents(), SaveToDB(), SendUpdateToOutOfRangeGroupMembers(), SetGameMaster(), Unit::SetSpeed(), TeleportTo(), UnsummonPetTemporaryIfAny(), and Update().

◆ GetPetStable() [1/2]

◆ GetPetStable() [2/2]

PetStable const * Player::GetPetStable ( ) const
inline
1226{ return m_petStable.get(); }

References m_petStable.

◆ GetPhaseMaskForSpawn()

uint32 Player::GetPhaseMaskForSpawn ( ) const
13742{
13744
13745 if (!phase)
13747
13748 // some aura phases include 1 normal map in addition to phase itself
13749 uint32 n_phase = phase & ~PHASEMASK_NORMAL;
13750 if (n_phase > 0)
13751 return n_phase;
13752
13753 return phase;
13754}
@ PHASEMASK_NORMAL
Definition Object.h:62
phase
Definition boss_skadi.cpp:103
uint32 GetPhaseByAuras() const
Definition Unit.cpp:19126
uint32 GetPhaseMask() const
Definition Object.h:502

References Unit::GetPhaseByAuras(), WorldObject::GetPhaseMask(), IsGameMaster(), and PHASEMASK_NORMAL.

Referenced by gobject_commandscript::HandleGameObjectAddCommand(), npc_commandscript::HandleNpcAddCommand(), wp_commandscript::HandleWpModifyCommand(), and wp_commandscript::HandleWpShowCommand().

◆ GetPlayerFlags()

PlayerFlags Player::GetPlayerFlags ( ) const
inline
PlayerFlags
Definition Player.h:479
@ PLAYER_FLAGS
Definition UpdateFields.h:178

References Object::GetUInt32Value(), and PLAYER_FLAGS.

Referenced by _SaveCharacter().

◆ GetPlayerName()

std::string Player::GetPlayerName ( )
16264{
16265 std::string name = GetName();
16266 std::string color = "";
16267
16268 switch (getClass())
16269 {
16270 case CLASS_DEATH_KNIGHT: color = "|cffC41F3B"; break;
16271 case CLASS_DRUID: color = "|cffFF7D0A"; break;
16272 case CLASS_HUNTER: color = "|cffABD473"; break;
16273 case CLASS_MAGE: color = "|cff69CCF0"; break;
16274 case CLASS_PALADIN: color = "|cffF58CBA"; break;
16275 case CLASS_PRIEST: color = "|cffFFFFFF"; break;
16276 case CLASS_ROGUE: color = "|cffFFF569"; break;
16277 case CLASS_SHAMAN: color = "|cff0070DE"; break;
16278 case CLASS_WARLOCK: color = "|cff9482C9"; break;
16279 case CLASS_WARRIOR: color = "|cffC79C6E"; break;
16280 }
16281
16282 return "|Hplayer:" + name + "|h" + color + name + "|h|r";
16283}
@ CLASS_PRIEST
Definition SharedDefines.h:145

References CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, Unit::getClass(), and WorldObject::GetName().

Referenced by gear_commandscript::HandleGearStatsCommand().

◆ GetPlayerSetting()

PlayerSetting Player::GetPlayerSetting ( std::string const &  source,
uint8  index 
)
63{
64 auto it = m_charSettingsMap.find(source);
65 if (it == m_charSettingsMap.end() || static_cast<size_t>(index) >= it->second.size())
66 {
67 UpdatePlayerSetting(source, index, 0);
68 return m_charSettingsMap[source][index];
69 }
70
71 return it->second[index];
72}
void UpdatePlayerSetting(std::string const &source, uint8 index, uint32 value)
Definition PlayerSettings.cpp:98

References m_charSettingsMap, and UpdatePlayerSetting().

Referenced by player_settings_commandscript::HandleSettingsAnnouncerFlags(), and ChatHandler::SendWorldTextOptional().

◆ GetPureMaxSkillValue()

uint16 Player::GetPureMaxSkillValue ( uint32  skill) const
5519{
5520 if (!skill)
5521 return 0;
5522
5523 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5524 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5525 return 0;
5526
5527 int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5528
5529 sScriptMgr->OnPlayerGetMaxSkillValue(const_cast<Player*>(this), skill, result, true);
5530
5531 return result < 0 ? 0 : result;
5532}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_MAX, and sScriptMgr.

Referenced by _addSpell(), learn_commandscript::HandleLearnAllRecipesCommand(), lookup_commandscript::HandleLookupSkillCommand(), misc_commandscript::HandleSetSkillCommand(), and removeSpell().

◆ GetPureSkillValue()

uint16 Player::GetPureSkillValue ( uint32  skill) const

◆ GetQuestDialogStatus()

QuestGiverStatus Player::GetQuestDialogStatus ( Object questGiver)
1596{
1599
1600 sScriptMgr->GetDialogStatus(this, questgiver);
1601
1602 switch (questgiver->GetTypeId())
1603 {
1604 case TYPEID_GAMEOBJECT:
1605 {
1606 QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToGameObject()));
1607 if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
1608 return questStatus;
1609 qr = sObjectMgr->GetGOQuestRelationBounds(questgiver->GetEntry());
1610 qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(questgiver->GetEntry());
1611 break;
1612 }
1613 case TYPEID_UNIT:
1614 {
1615 QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToCreature()));
1616 if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
1617 return questStatus;
1618 qr = sObjectMgr->GetCreatureQuestRelationBounds(questgiver->GetEntry());
1619 qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(questgiver->GetEntry());
1620 break;
1621 }
1622 default:
1623 // it's impossible, but check
1624 //LOG_ERROR("entities.player.quest", "GetQuestDialogStatus called for unexpected type {}", questgiver->GetTypeId());
1625 return DIALOG_STATUS_NONE;
1626 }
1627
1629
1630 for (QuestRelations::const_iterator i = qir.first; i != qir.second; ++i)
1631 {
1633 uint32 questId = i->second;
1634 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1635 if (!quest)
1636 continue;
1637
1638 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, quest->GetQuestId());
1639 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1640 continue;
1641
1642 QuestStatus status = GetQuestStatus(questId);
1643 if (status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(questId))
1644 {
1645 result2 = DIALOG_STATUS_REWARD;
1646 }
1647 else if (status == QUEST_STATUS_INCOMPLETE)
1648 {
1649 result2 = DIALOG_STATUS_INCOMPLETE;
1650 }
1651
1652 if (quest->IsAutoComplete() && CanTakeQuest(quest, false) && quest->IsRepeatable() && !quest->IsDailyOrWeekly())
1653 {
1654 result2 = DIALOG_STATUS_REWARD_REP;
1655 }
1656
1657 if (result2 > result)
1658 {
1659 result = result2;
1660 }
1661 }
1662
1663 for (QuestRelations::const_iterator i = qr.first; i != qr.second; ++i)
1664 {
1666 uint32 questId = i->second;
1667 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1668 if (!quest)
1669 continue;
1670
1671 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, quest->GetQuestId());
1672 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1673 continue;
1674
1675 QuestStatus status = GetQuestStatus(questId);
1676 if (status == QUEST_STATUS_NONE)
1677 {
1678 if (CanSeeStartQuest(quest))
1679 {
1680 if (SatisfyQuestLevel(quest, false))
1681 {
1682 bool isNotLowLevelQuest = GetLevel() <= (GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF));
1683
1684 if (quest->IsRepeatable())
1685 {
1686 if (quest->IsDaily())
1687 {
1688 if (isNotLowLevelQuest)
1689 {
1691 }
1692 else
1693 {
1695 }
1696 }
1697 else if (quest->IsWeekly() || quest->IsMonthly())
1698 {
1699 if (isNotLowLevelQuest)
1700 {
1701 result2 = DIALOG_STATUS_AVAILABLE;
1702 }
1703 else
1704 {
1706 }
1707 }
1708 else if (quest->IsAutoComplete())
1709 {
1710 if (isNotLowLevelQuest)
1711 {
1712 result2 = DIALOG_STATUS_REWARD_REP;
1713 }
1714 else
1715 {
1717 }
1718 }
1719 else
1720 {
1721 if (isNotLowLevelQuest)
1722 {
1723 result2 = DIALOG_STATUS_REWARD_REP;
1724 }
1725 else
1726 {
1728 }
1729 }
1730 }
1731 else
1732 {
1733 result2 = isNotLowLevelQuest ? DIALOG_STATUS_AVAILABLE : DIALOG_STATUS_LOW_LEVEL_AVAILABLE;
1734 }
1735 }
1736 else
1737 {
1738 result2 = DIALOG_STATUS_UNAVAILABLE;
1739 }
1740 }
1741 }
1742
1743 if (result2 > result)
1744 result = result2;
1745 }
1746
1747 return result;
1748}
@ CONDITION_SOURCE_TYPE_QUEST_AVAILABLE
Definition ConditionMgr.h:142
QuestGiverStatus
Definition QuestDef.h:111
@ DIALOG_STATUS_UNAVAILABLE
Definition QuestDef.h:113
@ DIALOG_STATUS_NONE
Definition QuestDef.h:112
@ DIALOG_STATUS_AVAILABLE
Definition QuestDef.h:120
@ DIALOG_STATUS_SCRIPTED_NO_STATUS
Definition QuestDef.h:125
@ DIALOG_STATUS_LOW_LEVEL_REWARD_REP
Definition QuestDef.h:115
@ DIALOG_STATUS_REWARD
Definition QuestDef.h:122
@ DIALOG_STATUS_LOW_LEVEL_AVAILABLE
Definition QuestDef.h:114
@ DIALOG_STATUS_REWARD_REP
Definition QuestDef.h:118
@ DIALOG_STATUS_INCOMPLETE
Definition QuestDef.h:117
@ DIALOG_STATUS_LOW_LEVEL_AVAILABLE_REP
Definition QuestDef.h:116
@ DIALOG_STATUS_AVAILABLE_REP
Definition QuestDef.h:119
@ CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF
Definition WorldConfig.h:236
int32 GetQuestLevel(Quest const *quest) const
Definition Player.h:1439
bool CanSeeStartQuest(Quest const *quest)
Definition PlayerQuest.cpp:237
uint32 GetQuestId() const
Definition QuestDef.h:228
bool IsDaily() const
Definition QuestDef.h:287
bool IsWeekly() const
Definition QuestDef.h:288
bool IsDailyOrWeekly() const
Definition QuestDef.h:291
bool IsMonthly() const
Definition QuestDef.h:289

References CanSeeStartQuest(), CanTakeQuest(), CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, DIALOG_STATUS_AVAILABLE, DIALOG_STATUS_AVAILABLE_REP, DIALOG_STATUS_INCOMPLETE, DIALOG_STATUS_LOW_LEVEL_AVAILABLE, DIALOG_STATUS_LOW_LEVEL_AVAILABLE_REP, DIALOG_STATUS_LOW_LEVEL_REWARD_REP, DIALOG_STATUS_NONE, DIALOG_STATUS_REWARD, DIALOG_STATUS_REWARD_REP, DIALOG_STATUS_SCRIPTED_NO_STATUS, DIALOG_STATUS_UNAVAILABLE, Object::GetEntry(), Unit::GetLevel(), Quest::GetQuestId(), GetQuestLevel(), GetQuestRewardStatus(), GetQuestStatus(), Object::GetTypeId(), Quest::IsAutoComplete(), Quest::IsDaily(), Quest::IsDailyOrWeekly(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, SatisfyQuestLevel(), sConditionMgr, sObjectMgr, sScriptMgr, sWorld, Object::ToCreature(), Object::ToGameObject(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by GameObject::ActivateToQuest(), WorldSession::HandleQuestgiverChooseRewardOpcode(), and WorldSession::HandleQuestgiverStatusQueryOpcode().

◆ GetQuestLevel()

int32 Player::GetQuestLevel ( Quest const *  quest) const
inline

◆ GetQuestRate()

float Player::GetQuestRate ( bool  isDFQuest = false)
16215{
16216 float result = isDFQuest ? sWorld->getRate(RATE_XP_QUEST_DF) : sWorld->getRate(RATE_XP_QUEST);
16217
16218 sScriptMgr->OnPlayerGetQuestRate(this, result);
16219
16220 return result;
16221}
@ RATE_XP_QUEST_DF
Definition WorldConfig.h:428
@ RATE_XP_QUEST
Definition WorldConfig.h:427

References RATE_XP_QUEST, RATE_XP_QUEST_DF, sScriptMgr, and sWorld.

Referenced by CalculateQuestRewardXP().

◆ GetQuestRewardStatus()

◆ GetQuestSlotCounter()

uint16 Player::GetQuestSlotCounter ( uint16  slot,
uint8  counter 
) const
inline
1501{ return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16)); }
@ QUEST_COUNTS_OFFSET
Definition Player.h:631
#define MAX_QUEST_OFFSET
Definition Player.h:635
@ PLAYER_QUEST_LOG_1_1
Definition UpdateFields.h:186

References Object::GetUInt64Value(), MAX_QUEST_OFFSET, PLAYER_QUEST_LOG_1_1, and QUEST_COUNTS_OFFSET.

Referenced by SendQuestUpdateAddCreatureOrGo(), and SendQuestUpdateAddPlayer().

◆ GetQuestSlotQuestId()

◆ GetQuestSlotState()

uint32 Player::GetQuestSlotState ( uint16  slot) const
inline

◆ GetQuestSlotTime()

uint32 Player::GetQuestSlotTime ( uint16  slot) const
inline

◆ GetQuestStatus()

QuestStatus Player::GetQuestStatus ( uint32  quest_id) const
1431{
1432 if (quest_id)
1433 {
1434 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
1435
1436 if (itr != m_QuestStatus.end())
1437 {
1438 return itr->second.Status;
1439 }
1440
1441 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id))
1442 {
1443 if (qInfo->IsSeasonal())
1444 {
1446 }
1447
1448 if (!qInfo->IsRepeatable() && IsQuestRewarded(quest_id))
1449 {
1450 return QUEST_STATUS_REWARDED;
1451 }
1452 }
1453 }
1454
1455 return QUEST_STATUS_NONE;
1456}
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:106

References IsQuestRewarded(), m_QuestStatus, QUEST_STATUS_NONE, QUEST_STATUS_REWARDED, SatisfyQuestSeasonal(), and sObjectMgr.

Referenced by GameObject::ActivateToQuest(), LootItem::AllowedForPlayer(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::AttackStart(), CanRewardQuest(), ServerMailCondition::CheckCondition(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), spell_item_demon_broiled_surprise::CheckRequirement(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::CreditPlayer(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), DuelComplete(), Spell::EffectQuestClear(), Spell::EffectScriptEffect(), SmartAI::EndPath(), FailQuest(), npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), go_gilded_brazier::go_gilded_brazierAI::GossipHello(), go_tadpole_cage::go_tadpole_cageAI::GossipHello(), WorldSession::HandleAreaTriggerOpcode(), spell_midsummer_torch_catch::HandleDummy(), spell_q12014_steady_as_a_rock::HandleFinish(), spell_sindragosa_frost_breath::HandleInfusion(), lookup_commandscript::HandleLookupQuestCommand(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), WorldSession::HandleQuestgiverRequestRewardOpcode(), spell_q11322_q11317_the_cleansing::if(), SpellArea::IsFitToRequirements(), npc_kservant::npc_kservantAI::IsSummonedBy(), npc_clintar_spirit::npc_clintar_spiritAI::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_alar::JustDied(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustEngagedWith(), spell_chapter2_persuasive_strike::Load(), npc_a_special_surprise::npc_a_special_surpriseAI::MeetQuestCondition(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::MoveInLineOfSight(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), npc_black_knight_graveyard::npc_black_knight_graveyardAI::MoveInLineOfSight(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_rizzle_sprysprocket::OnGossipHello(), npc_bunthen_plainswind::OnGossipHello(), npc_great_bear_spirit::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_plucky::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_iruk::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_adventurous_dwarf::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), go_inconspicuous_mine_car::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_tele_to_violet_stand::OnGossipHello(), go_ravager_cage::OnGossipHello(), go_bristlelimb_cage::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_warmaul_prison::OnGossipHello(), go_skull_pile::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_table_theka::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), go_amberpine_outhouse::OnGossipHello(), go_veil_skith_cage::OnGossipHello(), npc_great_bear_spirit::OnGossipSelect(), at_ancient_leaf::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), AreaTrigger_at_last_rites::OnTrigger(), at_malfurion_stormrage::OnTrigger(), at_commander_dawnforge::OnTrigger(), item_captured_frog::OnUse(), npc_doctor::npc_doctorAI::PatientDied(), npc_doctor::npc_doctorAI::PatientSaved(), PrepareQuestMenu(), NPCStaveQuestAI::QuestIncomplete(), npc_shenthul::npc_shenthulAI::ReceiveEmote(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), SatisfyQuestExclusiveGroup(), SatisfyQuestNextChain(), SatisfyQuestPreviousQuest(), SatisfyQuestStatus(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetBossState(), npc_costumed_orphan_matron::sGossipHello(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::sGossipSelect(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), Battleground::SpiritOfCompetitionEvent(), npc_clintar_spirit::npc_clintar_spiritAI::StartEvent(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), and GameObject::Use().

◆ getQuestStatusMap()

◆ GetQuestStatusSaveMap()

QuestStatusSaveMap & Player::GetQuestStatusSaveMap ( )
inline
1640{ return m_QuestStatusSave; }

References m_QuestStatusSave.

◆ GetRaidDifficulty()

◆ GetRandomWinner()

bool Player::GetRandomWinner ( )
inline

◆ GetRank()

uint8 Player::GetRank ( ) const
inline

◆ GetRatingBonusValue()

◆ GetRatingMultiplier()

float Player::GetRatingMultiplier ( CombatRating  cr) const
5216{
5217 uint8 level = GetLevel();
5218
5219 if (level > GT_MAX_LEVEL)
5220 level = GT_MAX_LEVEL;
5221
5222 GtCombatRatingsEntry const* Rating = sGtCombatRatingsStore.LookupEntry(cr * GT_MAX_LEVEL + level - 1);
5223 // gtOCTClassCombatRatingScalarStore.dbc starts with 1, CombatRating with zero, so cr+1
5224 GtOCTClassCombatRatingScalarEntry const* classRating = sGtOCTClassCombatRatingScalarStore.LookupEntry((getClass() - 1) * GT_MAX_RATING + cr + 1);
5225 if (!Rating || !classRating)
5226 return 1.0f; // By default use minimum coefficient (not must be called)
5227
5228 return classRating->ratio / Rating->ratio;
5229}
DBCStorage< GtCombatRatingsEntry > sGtCombatRatingsStore(GtCombatRatingsfmt)
DBCStorage< GtOCTClassCombatRatingScalarEntry > sGtOCTClassCombatRatingScalarStore(GtOCTClassCombatRatingScalarfmt)
#define GT_MAX_RATING
Definition DBCStructure.h:1040
Definition DBCStructure.h:1048
float ratio
Definition DBCStructure.h:1049
Definition DBCStructure.h:1078
float ratio
Definition DBCStructure.h:1079

References Unit::getClass(), Unit::GetLevel(), GT_MAX_LEVEL, GT_MAX_RATING, GtCombatRatingsEntry::ratio, GtOCTClassCombatRatingScalarEntry::ratio, sGtCombatRatingsStore, and sGtOCTClassCombatRatingScalarStore.

Referenced by ApplyRatingMod(), and GetRatingBonusValue().

◆ GetRealDodge()

float Player::GetRealDodge ( ) const
inline
2624{ return m_realDodge; }

References m_realDodge.

Referenced by Unit::GetUnitDodgeChance().

◆ GetRealParry()

float Player::GetRealParry ( ) const
inline
2623{ return m_realParry; }

References m_realParry.

◆ GetReputation()

uint32 Player::GetReputation ( uint32  factionentry) const
15307{
15308 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
15309}
int32 GetReputation(uint32 faction_id) const
Definition ReputationMgr.cpp:78

References ReputationMgr::GetReputation(), GetReputationMgr(), and sFactionStore.

Referenced by CanCompleteQuest(), ReputationChanged(), ReputationChanged2(), and SatisfyQuestReputation().

◆ GetReputationMgr() [1/2]

◆ GetReputationMgr() [2/2]

ReputationMgr const & Player::GetReputationMgr ( ) const
inline
2144{ return *m_reputationMgr; }

References m_reputationMgr.

◆ GetReputationPriceDiscount() [1/2]

◆ GetReputationPriceDiscount() [2/2]

float Player::GetReputationPriceDiscount ( FactionTemplateEntry const *  factionTemplate) const
12311{
12312 if (!factionTemplate || !factionTemplate->faction)
12313 {
12314 return 1.0f;
12315 }
12316
12317 ReputationRank rank = GetReputationRank(factionTemplate->faction);
12318 if (rank <= REP_NEUTRAL)
12319 {
12320 return 1.0f;
12321 }
12322
12323 return 1.0f - 0.05f * (rank - REP_NEUTRAL);
12324}
ReputationRank
Definition SharedDefines.h:179
@ REP_NEUTRAL
Definition SharedDefines.h:183

References FactionTemplateEntry::faction, GetReputationRank(), and REP_NEUTRAL.

◆ GetReputationRank()

◆ GetReqKillOrCastCurrentCount()

uint16 Player::GetReqKillOrCastCurrentCount ( uint32  quest_id,
int32  entry 
)
1752{
1753 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
1754 if (!qInfo)
1755 return 0;
1756
1757 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
1758 if (qInfo->RequiredNpcOrGo[j] == entry)
1759 return m_QuestStatus[quest_id].CreatureOrGOCount[j];
1760
1761 return 0;
1762}

References m_QuestStatus, QUEST_OBJECTIVES_COUNT, Quest::RequiredNpcOrGo, and sObjectMgr.

Referenced by npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), and npc_razael_and_lyana::OnGossipHello().

◆ GetRestBonus()

float Player::GetRestBonus ( ) const
inline
1216{ return _restBonus; }

References _restBonus.

Referenced by GetXPRestBonus(), LoadFromDB(), and Update().

◆ GetResurrectionSpellId()

uint32 Player::GetResurrectionSpellId ( )
12582{
12583 // search priceless resurrection possibilities
12584 uint32 prio = 0;
12585 uint32 spell_id = 0;
12587 for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
12588 {
12589 // Soulstone Resurrection // prio: 3 (max, non death persistent)
12590 if (prio < 2 && (*itr)->GetSpellInfo()->SpellVisual[0] == 99 && (*itr)->GetSpellInfo()->SpellIconID == 92)
12591 {
12592 switch ((*itr)->GetId())
12593 {
12594 case 20707:
12595 spell_id = 3026;
12596 break; // rank 1
12597 case 20762:
12598 spell_id = 20758;
12599 break; // rank 2
12600 case 20763:
12601 spell_id = 20759;
12602 break; // rank 3
12603 case 20764:
12604 spell_id = 20760;
12605 break; // rank 4
12606 case 20765:
12607 spell_id = 20761;
12608 break; // rank 5
12609 case 27239:
12610 spell_id = 27240;
12611 break; // rank 6
12612 case 47883:
12613 spell_id = 47882;
12614 break; // rank 7
12615 default:
12616 LOG_ERROR("entities.player", "Unhandled spell {}: S.Resurrection", (*itr)->GetId());
12617 continue;
12618 }
12619
12620 prio = 3;
12621 }
12622 // Twisting Nether // prio: 2 (max)
12623 else if ((*itr)->GetId() == 23701 && roll_chance_i(10))
12624 {
12625 prio = 2;
12626 spell_id = 23700;
12627 }
12628 }
12629
12630 // Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life
12631 if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030)))
12632 spell_id = 21169;
12633
12634 return spell_id;
12635}
bool roll_chance_i(int chance)
Definition Random.h:63
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67

References Unit::GetAuraEffectsByType(), Unit::HasAura(), HasItemCount(), HasSpell(), HasSpellCooldown(), LOG_ERROR, roll_chance_i(), and SPELL_AURA_DUMMY.

Referenced by Unit::Kill(), and setDeathState().

◆ GetRewardedQuestCount()

std::size_t Player::GetRewardedQuestCount ( ) const
inline
1642{ return m_RewardedQuests.size(); }

References m_RewardedQuests.

Referenced by WorldSession::HandleQueryQuestsCompleted().

◆ getRewardedQuests()

RewardedQuestSet const & Player::getRewardedQuests ( ) const
inline

◆ GetRuneBaseCooldown()

uint32 Player::GetRuneBaseCooldown ( uint8  index,
bool  skipGrace 
)
13336{
13337 uint8 rune = GetBaseRune(index);
13338 uint32 cooldown = RUNE_BASE_COOLDOWN;
13339 if (!skipGrace)
13340 cooldown -= GetGracePeriod(index) < 250 ? 0 : GetGracePeriod(index) - 250; // xinef: reduce by grace period, treat first 250ms as instant use of rune
13341
13343 for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
13344 {
13345 if ((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune)
13346 cooldown = cooldown * (100 - (*i)->GetAmount()) / 100;
13347 }
13348
13349 return cooldown;
13350}
@ RUNE_BASE_COOLDOWN
Definition Player.h:408
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
Definition SpellAuraDefines.h:173
uint32 GetGracePeriod(uint8 index) const
Definition Player.h:2526
RuneType GetBaseRune(uint8 index) const
Definition Player.h:2523

References Unit::GetAuraEffectsByType(), GetBaseRune(), GetGracePeriod(), POWER_RUNE, RUNE_BASE_COOLDOWN, and SPELL_AURA_MOD_POWER_REGEN_PERCENT.

Referenced by Spell::TakeRunePower(), and UpdateRuneRegen().

◆ GetRuneCooldown()

uint32 Player::GetRuneCooldown ( uint8  index) const
inline

◆ GetRunesState()

uint8 Player::GetRunesState ( ) const
inline
2522{ return m_runes->runeState; }
uint8 runeState
Definition Player.h:434

References m_runes, and Runes::runeState.

Referenced by Spell::EffectActivateRune(), and Spell::TakeRunePower().

◆ getRuneWeaponGUID()

ObjectGuid Player::getRuneWeaponGUID ( )
inline
2609{ return m_drwGUID; };
ObjectGuid m_drwGUID
Definition Player.h:2610

References m_drwGUID.

◆ GetSaveTimer()

uint32 Player::GetSaveTimer ( ) const
inline
2373{ return m_nextSave; }

References m_nextSave.

Referenced by misc_commandscript::HandleSaveCommand().

◆ GetSelectedPlayer()

Player * Player::GetSelectedPlayer ( ) const
11517{
11518 if (ObjectGuid selectionGUID = GetGuidValue(UNIT_FIELD_TARGET))
11519 return ObjectAccessor::GetPlayer(*this, selectionGUID);
11520
11521 return nullptr;
11522}
@ UNIT_FIELD_TARGET
Definition UpdateFields.h:92
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition ObjectAccessor.cpp:220

References Object::GetGuidValue(), ObjectAccessor::GetPlayer(), and UNIT_FIELD_TARGET.

Referenced by Acore::ChatCommands::PlayerIdentifier::FromTarget().

◆ GetSelectedUnit()

◆ GetSemaphoreTeleportFar()

time_t Player::GetSemaphoreTeleportFar ( ) const
inline
2114{ return mSemaphoreTeleport_Far; }

References mSemaphoreTeleport_Far.

◆ GetSemaphoreTeleportNear()

time_t Player::GetSemaphoreTeleportNear ( ) const
inline
2113{ return mSemaphoreTeleport_Near; }

References mSemaphoreTeleport_Near.

◆ GetSession()

WorldSession * Player::GetSession ( ) const
inline
2016{ return m_session; }

References m_session.

Referenced by _addSpell(), _LoadHomeBind(), _LoadInventory(), Pet::_LoadSpellCooldowns(), Battleground::_ProcessProgress(), _SaveCharacter(), _SaveInstanceTimeRestrictions(), _StoreOrEquipNewItem(), ActivateSpec(), ActivateTaxiPathTo(), AddEnchantmentDuration(), AddItem(), Guild::AddMember(), InstanceMap::AddPlayerToMap(), AddRunePower(), addSpell(), Channel::Announce(), ApplyEquipCooldown(), Battlefield::AskToLeaveQueue(), TotemAI::AttackStart(), AutoUnequipOffhandIfNeed(), BanMgr::BanCharacter(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), BindToInstance(), Group::BroadcastPacket(), Group::BroadcastReadyCheck(), SocialMgr::BroadcastToFriendListers(), BuildPlayerRepop(), GameObject::BuildValuesUpdate(), BuyItemFromVendorSlot(), WorldSession::CanOpenMailBox(), CanSpeak(), BattlegroundSA::CaptureGraveyard(), CharacterActionIpLogger::CharacterIPLogAction(), CharmSpellInitialize(), Spell::CheckCast(), ServerMailCondition::CheckCondition(), CheckDuelDistance(), Spell::CheckEffectTarget(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::CheckRequiredBosses(), AchievementMgr::CompletedAchievement(), ContinueTaxiFlight(), ConvertRune(), Create(), Guild::Create(), ArenaTeam::DelMember(), Object::DestroyForPlayer(), Group::Disband(), InstanceScript::DoSendNotifyToInstance(), DuelComplete(), DurabilityRepair(), Spell::EffectApplyGlyph(), Spell::EffectDiscoverTaxi(), Spell::EffectDuel(), Spell::EffectPlaySound(), Spell::EffectSummonPlayer(), Spell::EffectSummonRaFFriend(), EquipItem(), BattlegroundSA::EventPlayerDamagedGO(), BGQueueInviteEvent::Execute(), SendEncounterUnit::Execute(), ExecuteOrCancelSpellCastRequest(), lfg::LFGMgr::FinishDungeon(), Channel::FlagsNotify(), GetAurasForTarget(), ChannelMgr::GetChannel(), SocialMgr::GetFriendInfo(), getMaxTimer(), GetsRecruitAFriendBonus(), GiveLevel(), Group::GroupLoot(), WorldSession::HandleAcceptGrantLevel(), WorldSession::HandleAcceptTradeOpcode(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), spell_madrigosa_activate_barrier::HandleActivateObject(), spell_madrigosa_deactivate_barrier::HandleActivateObject(), WorldSession::HandleAddFriendOpcode(), misc_commandscript::HandleAddItemCommand(), BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleAuctionListItems(), AuraEffect::HandleAuraOpenStable(), AuraEffect::HandleAuraSetVehicle(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleBeginTradeOpcode(), character_commandscript::HandleCharacterLevel(), WorldSession::HandleChatIgnoredOpcode(), debug_commandscript::HandleDebugSendOpcodeCommand(), spell_gen_spirit_healer_res::HandleDummy(), cheat_commandscript::HandleExploreCheatCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupDeclineOpcode(), WorldSession::HandleGroupInviteOpcode(), group_commandscript::HandleGroupReviveCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleInitiateTradeOpcode(), Guild::HandleInviteMember(), lookup_commandscript::HandleLookupPlayerIpCommand(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMessagechatOpcode(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHPCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), modify_commandscript::HandleModifySpellCommand(), WorldSession::HandleMovementOpcodes(), misc_commandscript::HandleMuteCommand(), WorldSession::HandleOfferPetitionOpcode(), misc_commandscript::HandlePInfoCommand(), Battlefield::HandlePlayerLeaveZone(), OutdoorPvP::HandlePlayerLeaveZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginOpcode(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleRaidReadyCheckOpcode(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), spell_the_flag_of_ownership::HandleScript(), WorldSession::HandleSendMail(), send_commandscript::HandleSendMessageCommand(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnmuteCommand(), WorldSession::HandleWhoisOpcode(), WorldSession::HandleWhoOpcode(), ChatHandler::HasLowerSecurity(), hasSpanishClient(), lfg::LFGMgr::InitializeLockedDungeons(), InitTalentForLevel(), BattlegroundQueue::InviteGroupToBG(), Battlefield::InvitePlayerToQueue(), Battlefield::InvitePlayerToWar(), isBeingLoaded(), IsNeverVisible(), IsPetNeedBeTemporaryUnsummoned(), ObjectMgr::IsVendorItemValid(), IsVisibleGloballyFor(), Channel::JoinChannel(), lfg::LFGMgr::JoinLfg(), Channel::JoinNotify(), Unit::JumpTo(), Channel::KickOrBan(), Unit::KnockbackFrom(), Channel::LeaveNotify(), Channel::List(), LoadFromDB(), Pet::LoadPetFromDB(), GameObject::ModifyHealth(), ModifySpellCooldown(), Group::NeedBeforeGreed(), go_tele_to_dalaran_crystal::OnGossipHello(), go_ulduar_pure_saronite_deposit::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), npc_augustus_the_touched::OnGossipSelect(), npc_rivern_frostwind::OnGossipSelect(), npc_roxi_ramrocket::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_wg_quest_giver::OnGossipSelect(), npc_drake_dealer_hurlunk::OnGossipSelect(), npc_shattrathflaskvendors::OnGossipSelect(), npc_slim::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_prof_leather::OnGossipSelect(), npc_icc_buff_switcher::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), OnGossipSelect(), BattlefieldWG::OnPlayerLeaveWar(), ServerMailReward::OnPlayerLogin(), lfg::LFGPlayerScript::OnPlayerLogout(), lfg::LFGPlayerScript::OnPlayerMapChanged(), Acore::LocalizedPacketDo< Builder >::operator()(), Acore::LocalizedPacketListDo< Builder >::operator()(), CreatureTextLocalizer< Builder >::operator()(), Channel::Password(), Unit::PatchValuesUpdate(), InstanceMap::PermBindAllPlayers(), PetSpellInitialize(), Player(), Battlefield::PlayerAcceptInviteToQueue(), Battlefield::PlayerAcceptInviteToWar(), Battleground::PlayerAddedToBGCheckIfBGIsRunning(), InstanceSaveMgr::PlayerBindToInstance(), MapMgr::PlayerCannotEnter(), InstanceSaveMgr::PlayerUnbindInstance(), InstanceSaveMgr::PlayerUnbindInstanceNotExtended(), PossessSpellInitialize(), BattlegroundSA::PostUpdateImpl(), PrepareGossipMenu(), PrettyPrintRequirementsAchievementsList(), PrettyPrintRequirementsItemsList(), PrettyPrintRequirementsQuestList(), ProhibitSpellSchool(), Battleground::ReadyMarkerClicked(), RefundItem(), Group::RemoveMember(), RemovePet(), RemovePetitionsAndSigns(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), Group::ResetMaxEnchantingLevel(), ResurrectPlayer(), ResyncRunes(), RewardHonor(), Satisfy(), SatisfyQuestLog(), SaveToDB(), SendActionButtons(), npc_prof_alchemy::SendActionMenu(), npc_prof_blacksmith::SendActionMenu(), npc_prof_tailor::SendActionMenu(), AchievementMgr::SendAllAchievementData(), BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(), Battlefield::SendAreaSpiritHealerQueryOpcode(), SendAttackSwingBadFacingAttack(), SendAttackSwingCancelAttack(), SendAttackSwingCantAttack(), SendAttackSwingDeadTarget(), SendAttackSwingNotInRange(), AuctionHouseMgr::SendAuctionExpiredMail(), AuctionHouseMgr::SendAuctionOutbiddedMail(), AuctionHouseMgr::SendAuctionSuccessfulMail(), AuctionHouseMgr::SendAuctionWonMail(), SendBuyError(), SendCanTakeQuestResponse(), Spell::SendCastResult(), Spell::SendCastResult(), SendCorpseReclaimDelay(), SendDuelCountdown(), SendDungeonDifficulty(), SendEnchantmentDurations(), SendEquipError(), SendEquipmentSetList(), SendExplorationExperience(), SocialMgr::SendFriendStatus(), ChatHandler::SendGMText(), ChatHandler::SendGMText(), SendInitialPacketsAfterAddToMap(), SendInitialPacketsBeforeAddToMap(), SendInitialSpells(), Map::SendInitTransports(), SendInstanceResetWarning(), BattlegroundQueue::SendJoinMessageArenaQueue(), SendLearnPacket(), lfg::LFGMgr::SendLfgRoleChosen(), SendLogXPGain(), Group::SendLootAllPassed(), Group::SendLootRoll(), Group::SendLootRollWon(), Group::SendLootStartRoll(), Group::SendLootStartRollToPlayer(), SendMailResult(), MailDraft::SendMailTo(), BattlegroundQueue::SendMessageBGQueue(), SendNewItem(), SendNewMail(), CreatureTextMgr::SendNonChatPacket(), AutobroadcastMgr::SendNotificationAnnouncement(), SendNotifyLootItemRemoved(), SendNotifyLootMoneyRemoved(), Acore::MessageDistDeliverer::SendPacket(), Acore::MessageDistDelivererToHostile::SendPacket(), Unit::SendPetActionFeedback(), Unit::SendPetAIReaction(), Spell::SendPetCastResult(), Unit::SendPetTalk(), WorldObject::SendPlayMusic(), SendPreparedQuest(), SendProficiency(), SendPushToPartyResponse(), SendQuestComplete(), SendQuestConfirmAccept(), SendQuestFailed(), SendQuestGiverStatusMultiple(), SendQuestReward(), SendQuestTimerFailed(), SendQuestUpdateAddCreatureOrGo(), SendQuestUpdateAddItem(), SendQuestUpdateAddPlayer(), lfg::LFGMgr::SendRaidBrowserCachedList(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), SendRaidDifficulty(), SendRaidInfo(), SendRefundInfo(), SendRemoveControlBar(), Map::SendRemoveTransports(), SendResetFailedNotify(), SendResetInstanceFailed(), SendResetInstanceSuccess(), AchievementMgr::SendRespondInspectAchievements(), Spell::SendResurrectRequest(), SendSavedInstances(), SendSellError(), PlayerSocial::SendSocialList(), SendSystemMessage(), SendTalentsInfoData(), SendTalentWipeConfirm(), SendTeleportAckPacket(), Item::SendTimeUpdate(), Acore::VisibleNotifier::SendToSelf(), SendTransferAborted(), BattlegroundSA::SendTransportInit(), BattlegroundSA::SendTransportsRemove(), Item::SendUpdateSockets(), Group::SendUpdateToPlayer(), Object::SendUpdateToPlayer(), ReputationMgr::SendVisible(), AutobroadcastMgr::SendWorldAnnouncement(), ChatHandler::SendWorldText(), ChatHandler::SendWorldText(), ChatHandler::SendWorldTextOptional(), ChatHandler::SendWorldTextOptional(), TradeData::SetAccepted(), SetBindPoint(), SetClientControl(), Item::SetEnchantment(), SetEquipmentSet(), SetGameMaster(), SetGMVisible(), Channel::SetMode(), TradeData::SetMoney(), SetMovement(), Channel::SetOwner(), SetRestBonus(), Unit::SetStandState(), Guild::Member::SetStats(), SetTitle(), Channel::ShouldAnnouncePlayer(), SpawnCorpseBones(), SummonPet(), lfg::LFGMgr::TeleportPlayer(), TeleportTo(), Channel::ToggleModeration(), TradeCancel(), Channel::UnBan(), AuctionHouseSearcher::Update(), TradeData::Update(), Map::Update(), Pet::Update(), GameObject::Update(), Update(), PetAI::UpdateAI(), UpdateHomebindTime(), UpdateLocalChannels(), Group::UpdatePlayerOutOfRange(), UpdatePosition(), UpdateSpeakTime(), UpdateTriggerVisibility(), GameObject::Use(), VehicleSpellInitialize(), Whisper(), Unit::Whisper(), Unit::Whisper(), and Whisper().

◆ GetShield()

Item * Player::GetShield ( bool  useable = false) const
524{
525 Item* item = nullptr;
526 if (useable)
528 else
530 if (!item || item->GetTemplate()->Class != ITEM_CLASS_ARMOR)
531 return nullptr;
532
533 if (!useable)
534 return item;
535
536 if (item->IsBroken())
537 return nullptr;
538
539 return item;
540}
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.h:1266

References ItemTemplate::Class, EQUIPMENT_SLOT_OFFHAND, GetItemByPos(), Item::GetTemplate(), GetUseableItemByPos(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), and ITEM_CLASS_ARMOR.

Referenced by AuraEffect::CalculateAmount().

◆ GetShieldBlockValue()

uint32 Player::GetShieldBlockValue ( ) const
overridevirtual

Implements Unit.

5120{
5122
5123 value = (value < 0) ? 0 : value;
5124
5125 return uint32(value);
5126}

References FLAT_MOD, Unit::GetStat(), m_auraBaseMod, PCT_MOD, SHIELD_BLOCK_VALUE, and STAT_STRENGTH.

Referenced by UpdateShieldBlockValue().

◆ GetSightRange()

float Player::GetSightRange ( WorldObject const *  target = nullptr) const
overridevirtual

Reimplemented from WorldObject.

16253{
16254 float sightRange = WorldObject::GetSightRange(target);
16256 {
16257 sightRange += *_farSightDistance;
16258 }
16259
16260 return sightRange;
16261}
virtual float GetSightRange(WorldObject const *target=nullptr) const
Definition Object.cpp:1640

References _farSightDistance, and WorldObject::GetSightRange().

Referenced by Acore::VisibleNotifier::SendToSelf(), Group::UpdatePlayerOutOfRange(), and UpdateVisibilityForPlayer().

◆ GetSkillPermBonusValue()

int16 Player::GetSkillPermBonusValue ( uint32  skill) const
5561{
5562 if (!skill)
5563 return 0;
5564
5565 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5566 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5567 return 0;
5568
5570}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, SKILL_DELETED, and SKILL_PERM_BONUS.

Referenced by lookup_commandscript::HandleLookupSkillCommand().

◆ GetSkillStatusMap() [1/2]

SkillStatusMap & Player::GetSkillStatusMap ( )
inline
1793{ return mSkillStatus; }

References mSkillStatus.

◆ GetSkillStatusMap() [2/2]

SkillStatusMap const & Player::GetSkillStatusMap ( ) const
inline
1792{ return mSkillStatus; }

References mSkillStatus.

Referenced by WorldSession::HandleAuctionListItems().

◆ GetSkillStep()

uint16 Player::GetSkillStep ( uint16  skill) const
5472{
5473 if (!skill)
5474 return 0;
5475
5476 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5477 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5478 return 0;
5479
5480 return PAIR32_HIPART(GetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos)));
5481}
uint16 PAIR32_HIPART(uint32 x)
Definition ObjectDefines.h:94

References Object::GetUInt32Value(), mSkillStatus, PAIR32_HIPART(), PLAYER_SKILL_INDEX, and SKILL_DELETED.

Referenced by learn_commandscript::HandleLearnAllRecipesCommand(), and misc_commandscript::HandleSetSkillCommand().

◆ GetSkillTempBonusValue()

int16 Player::GetSkillTempBonusValue ( uint32  skill) const
5573{
5574 if (!skill)
5575 return 0;
5576
5577 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5578 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5579 return 0;
5580
5582}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, SKILL_DELETED, and SKILL_TEMP_BONUS.

Referenced by lookup_commandscript::HandleLookupSkillCommand().

◆ GetSkillValue()

◆ GetSocial()

◆ GetSpec()

uint32 Player::GetSpec ( int8  spec = -1)
15979{
15980 uint32 mostTalentTabId = 0;
15981 uint32 mostTalentCount = 0;
15982 uint32 specIdx = 0;
15983
15984 if (m_specsCount) // not all instances of Player have a spec for some reason
15985 {
15986 if (spec < 0)
15987 specIdx = m_activeSpec;
15988 else
15989 specIdx = spec;
15990 // find class talent tabs (all players have 3 talent tabs)
15991 uint32 const* talentTabIds = GetTalentTabPages(getClass());
15992
15993 for (uint8 i = 0; i < MAX_TALENT_TABS; ++i)
15994 {
15995 uint32 talentCount = 0;
15996 uint32 talentTabId = talentTabIds[i];
15997 for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
15998 {
15999 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
16000 if (!talentInfo)
16001 continue;
16002
16003 // skip another tab talents
16004 if (talentInfo->TalentTab != talentTabId)
16005 continue;
16006
16007 // find max talent rank (0~4)
16008 int8 curtalent_maxrank = -1;
16009 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
16010 {
16011 if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], specIdx))
16012 {
16013 curtalent_maxrank = rank;
16014 break;
16015 }
16016 }
16017
16018 // not learned talent
16019 if (curtalent_maxrank < 0)
16020 continue;
16021
16022 talentCount += curtalent_maxrank + 1;
16023 }
16024
16025 if (mostTalentCount < talentCount)
16026 {
16027 mostTalentCount = talentCount;
16028 mostTalentTabId = talentTabId;
16029 }
16030 }
16031 }
16032 return mostTalentTabId;
16033}
uint32 const * GetTalentTabPages(uint8 cls)
Definition DBCStores.cpp:824
#define MAX_TALENT_TABS
Definition DBCStructure.h:1921

References Unit::getClass(), GetTalentTabPages(), HasTalent(), m_activeSpec, m_specsCount, MAX_TALENT_RANK, MAX_TALENT_TABS, TalentEntry::RankID, sTalentStore, and TalentEntry::TalentTab.

Referenced by HasCasterSpec(), HasHealSpec(), HasMeleeSpec(), and HasTankSpec().

◆ GetSpecsCount()

uint8 Player::GetSpecsCount ( ) const
inline

◆ GetSpellByProto()

uint32 Player::GetSpellByProto ( ItemTemplate proto)

◆ GetSpellCooldownDelay()

uint32 Player::GetSpellCooldownDelay ( uint32  spell_id) const
16313{
16314 SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
16315 return uint32(itr != m_spellCooldowns.end() && itr->second.end > getMSTime() ? itr->second.end - getMSTime() : 0);
16316}
uint32 getMSTime()
Definition Timer.h:103

References getMSTime(), and m_spellCooldowns.

Referenced by CanExecutePendingSpellCastRequest(), CanRequestSpellCast(), Aura::HandleAuraSpecificMods(), npc_brewfest_keg_reciver::MoveInLineOfSight(), and ProhibitSpellSchool().

◆ GetSpellCooldownMap() [1/2]

SpellCooldowns & Player::GetSpellCooldownMap ( )
inline
1790{ return m_spellCooldowns; }

References m_spellCooldowns.

◆ GetSpellCooldownMap() [2/2]

◆ GetSpellCooldowns()

SpellCooldowns Player::GetSpellCooldowns ( ) const
inline
2186{ return m_spellCooldowns; }

References m_spellCooldowns.

Referenced by Unit::HandleDummyAuraProc().

◆ GetSpellCritFromIntellect()

float Player::GetSpellCritFromIntellect ( )
5199{
5200 uint8 level = GetLevel();
5201 uint32 pclass = getClass();
5202
5203 if (level > GT_MAX_LEVEL)
5204 level = GT_MAX_LEVEL;
5205
5206 GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1);
5207 GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5208 if (!critBase || !critRatio)
5209 return 0.0f;
5210
5211 float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio;
5212 return crit * 100.0f;
5213}
DBCStorage< GtChanceToSpellCritBaseEntry > sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt)
DBCStorage< GtChanceToSpellCritEntry > sGtChanceToSpellCritStore(GtChanceToSpellCritfmt)
Definition DBCStructure.h:1063
float base
Definition DBCStructure.h:1064
Definition DBCStructure.h:1073
float ratio
Definition DBCStructure.h:1074

References GtChanceToSpellCritBaseEntry::base, Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtChanceToSpellCritEntry::ratio, sGtChanceToSpellCritBaseStore, sGtChanceToSpellCritStore, and STAT_INTELLECT.

Referenced by UpdateSpellCritChance().

◆ GetSpellMap() [1/2]

PlayerSpellMap & Player::GetSpellMap ( )
inline
1787{ return m_spells; }

References m_spells.

◆ GetSpellMap() [2/2]

◆ GetSpellModList()

SpellModList const & Player::GetSpellModList ( uint32  type) const
inline
2628{ return m_spellMods[type]; }

References m_spellMods.

Referenced by WorldSession::HandlePlayerLoginToCharInWorld().

◆ GetSpellPenetrationItemMod()

int32 Player::GetSpellPenetrationItemMod ( ) const
inline

◆ GetSpellQueueWindow()

uint32 Player::GetSpellQueueWindow ( ) const
protected
2309{
2310 return sWorld->getIntConfig(CONFIG_SPELL_QUEUE_WINDOW);
2311}
@ CONFIG_SPELL_QUEUE_WINDOW
Definition WorldConfig.h:378

References CONFIG_SPELL_QUEUE_WINDOW, and sWorld.

Referenced by CanExecutePendingSpellCastRequest(), and CanRequestSpellCast().

◆ GetsRecruitAFriendBonus()

bool Player::GetsRecruitAFriendBonus ( bool  forXP)
12655{
12656 bool recruitAFriend = false;
12657 if (GetLevel() <= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL) || !forXP)
12658 {
12659 if (Group* group = this->GetGroup())
12660 {
12661 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12662 {
12663 Player* player = itr->GetSource();
12664 if (!player || !player->IsInMap(this))
12665 continue;
12666
12667 if (!player->IsAtRecruitAFriendDistance(this))
12668 continue; // member (alive or dead) or his corpse at req. distance
12669
12670 if (forXP)
12671 {
12672 // level must be allowed to get RaF bonus
12673 if (player->GetLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
12674 continue;
12675
12676 // level difference must be small enough to get RaF bonus, UNLESS we are lower level
12677 if (player->GetLevel() < GetLevel())
12679 continue;
12680 }
12681
12682 bool ARecruitedB = (player->GetSession()->GetRecruiterId() == GetSession()->GetAccountId());
12683 bool BRecruitedA = (GetSession()->GetRecruiterId() == player->GetSession()->GetAccountId());
12684 if (ARecruitedB || BRecruitedA)
12685 {
12686 recruitAFriend = true;
12687 break;
12688 }
12689 }
12690 }
12691 }
12692 return recruitAFriend;
12693}
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL
Definition WorldConfig.h:197
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE
Definition WorldConfig.h:198
bool IsAtRecruitAFriendDistance(WorldObject const *pOther) const
Definition Player.cpp:12764
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1253
uint32 GetRecruiterId() const
Definition WorldSession.h:545

References CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL, CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE, WorldSession::GetAccountId(), GetGroup(), Unit::GetLevel(), WorldSession::GetRecruiterId(), GetSession(), IsAtRecruitAFriendDistance(), WorldObject::IsInMap(), and sWorld.

Referenced by CalculateReputationGain(), GiveXP(), and SetRestBonus().

◆ GetStartPosition()

WorldLocation Player::GetStartPosition ( ) const
11382{
11383 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
11384 uint32 mapId = info->mapId;
11386 return WorldLocation(0, 2352.0f, -5709.0f, 154.5f, 0.0f);
11387 return WorldLocation(mapId, info->positionX, info->positionY, info->positionZ, 0);
11388}

References CLASS_CONTEXT_INIT, CLASS_DEATH_KNIGHT, Unit::getClass(), Unit::getRace(), HasSpell(), IsClass(), PlayerInfo::mapId, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, and sObjectMgr.

Referenced by misc_commandscript::HandleUnstuckCommand().

◆ GetStoredRaidDifficulty()

Difficulty Player::GetStoredRaidDifficulty ( ) const
inline
1936{ return m_raidMapDifficulty; } // only for use in difficulty packet after exiting to raid map

References m_raidMapDifficulty.

Referenced by SendInitialPacketsAfterAddToMap().

◆ GetSubGroup()

uint8 Player::GetSubGroup ( ) const
inline

◆ GetSummonExpireTimer()

time_t Player::GetSummonExpireTimer ( ) const
inline
1120{ return m_summon_expire; }

References m_summon_expire.

Referenced by Spell::CheckCast().

◆ GetTalentMap()

◆ GetTalentTreePoints()

void Player::GetTalentTreePoints ( uint8(&)  specPoints[3]) const
15250{
15251 const PlayerTalentMap& talentMap = GetTalentMap();
15252 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
15253 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec()))
15254 if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID))
15255 if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab))
15256 if (tab->tabpage < 3)
15257 {
15258 // find current talent rank
15259 uint8 currentTalentRank = 0;
15260 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
15261 if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank])
15262 {
15263 currentTalentRank = rank + 1;
15264 break;
15265 }
15266 specPoints[tab->tabpage] += currentTalentRank;
15267 }
15268}

References GetActiveSpec(), GetTalentMap(), MAX_TALENT_RANK, PLAYERSPELL_REMOVED, sTalentStore, and sTalentTabStore.

Referenced by lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTeamId()

TeamId Player::GetTeamId ( bool  original = false) const
inline
2126{ return original ? TeamIdForRace(getRace(true)) : m_team; };
static TeamId TeamIdForRace(uint8 race)
Definition Player.cpp:5863

References Unit::getRace(), m_team, and TeamIdForRace().

Referenced by ActivateTaxiPathTo(), GameObject::ActivateToQuest(), BattlegroundQueue::AddGroup(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), npc_love_in_air_snivel::AllowAction(), BattlegroundSA::AllowDefenseOfTheAncients(), LootItem::AllowedForPlayer(), Battlefield::AskToLeaveQueue(), SocialMgr::BroadcastToFriendListers(), WorldState::BuffMagtheridonTeam(), Corpse::BuildValuesUpdate(), BuyItemFromVendorSlot(), npc_steam_powered_auctioneer::npc_steam_powered_auctioneerAI::CanBeSeen(), npc_mei_francis_mount::npc_mei_francis_mountAI::CanBeSeen(), Group::CanJoinBattlegroundQueue(), OPvPCapturePointZM_Graveyard::CanTalkTo(), CanUseItem(), BattlegroundSA::CaptureGraveyard(), ServerMailCondition::CheckCondition(), ContinueTaxiFlight(), MapInstanced::CreateInstance(), BattlegroundSA::DefendersPortalTeleport(), WorldState::DispelMagtheridonTeam(), BattlegroundIC::DoAction(), DuelComplete(), Spell::EffectTeleportUnits(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundSA::EventPlayerUsedGO(), GetBgTeamId(), Battlefield::GetClosestGraveyard(), BattlegroundAB::GetClosestGraveyard(), BattlegroundAV::GetClosestGraveyard(), BattlegroundEY::GetClosestGraveyard(), BattlegroundIC::GetClosestGraveyard(), BattlegroundSA::GetClosestGraveyard(), BattlegroundWS::GetClosestGraveyard(), SocialMgr::GetFriendInfo(), ObjectMgr::GetModelForShapeshift(), Battleground::GetRealRepFactionForPlayer(), Guild::HandleAcceptMember(), BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), BattlegroundEY::HandleAreaTrigger(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleArenaTeamAcceptOpcode(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleCalendarEventInvite(), OutdoorPvPSI::HandleDropFlag(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleInitiateTradeOpcode(), Guild::HandleInviteMember(), BattlefieldWG::HandleKill(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundAV::HandleKillPlayer(), BattlegroundIC::HandleKillPlayer(), BattlegroundAV::HandleKillUnit(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleOfferPetitionOpcode(), BfCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::HandlePlayerEnter(), WorldState::HandlePlayerEnterZone(), Battlefield::HandlePlayerEnterZone(), OutdoorPvP::HandlePlayerEnterZone(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), BfCapturePoint::HandlePlayerLeave(), OPvPCapturePoint::HandlePlayerLeave(), WorldState::HandlePlayerLeaveZone(), Battlefield::HandlePlayerLeaveZone(), OutdoorPvP::HandlePlayerLeaveZone(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), BattlegroundIC::HandlePlayerResurrect(), BattlegroundAV::HandleQuestComplete(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), spell_wintergrasp_portal::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), WorldSession::HandleSendMail(), WorldSession::HandleWhoOpcode(), Battlefield::HasPlayer(), OutdoorPvP::HasPlayer(), lfg::LFGMgr::InitializeLockedDungeons(), Channel::Invite(), Battlefield::InvitePlayerToQueue(), Battlefield::InvitePlayerToWar(), SpellArea::IsFitToRequirements(), IsGroupVisibleFor(), BfCapturePoint::IsInsideObjective(), OPvPCapturePoint::IsInsideObjective(), lfg::LFGMgr::JoinRaidBrowser(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustEngagedWith(), Unit::Kill(), lfg::LFGMgr::LfrSearchAdd(), lfg::LFGMgr::LfrSearchRemove(), lfg::LFGMgr::LfrSetComment(), LoadFromDB(), AchievementCriteriaData::Meets(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), achievement_resilient_victory::OnCheck(), achievement_bg_control_all_nodes::OnCheck(), achievement_bg_ic_resource_glut::OnCheck(), achievement_everything_counts::OnCheck(), achievement_bg_av_perfection::OnCheck(), achievement_not_even_a_scratch::OnCheck(), BattlefieldWG::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_bunthen_plainswind::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_spirit_guide::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), BattlefieldWG::OnPlayerJoinWar(), lfg::LFGPlayerScript::OnPlayerLogin(), ServerMailReward::OnPlayerLogin(), MidsummerPlayerScript::OnPlayerUpdateZone(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), AreaTrigger_at_legion_teleporter::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Battlefield::PlayerAcceptInviteToQueue(), Battlefield::PlayerAcceptInviteToWar(), RepopAtGraveyard(), ReportedAfkBy(), RewardHonor(), RewardReputation(), Satisfy(), AchievementMgr::SendAchievementEarned(), WorldSession::SendListInventory(), SendLoot(), Acore::MessageDistDeliverer::SendPacket(), lfg::LFGMgr::SendRaidBrowserCachedList(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), WorldSession::SendSpiritResurrect(), SendTaxiNodeStatusMultiple(), WorldSession::SendTaxiStatus(), Creature::SendZoneUnderAttackMessage(), spell_item_recall::SetDest(), SetEntryPoint(), SetFactionForRace(), Channel::SetMode(), Channel::SetOwner(), BattlegroundSA::TeleportToEntrancePosition(), OPvPCapturePoint::Update(), UpdateArea(), npc_midsummer_bonfire::UpdateBonfireBlessingBuffs(), UpdateLFGChannel(), UpdateLocalChannels(), UpdateZone(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ GetTeleportDest()

WorldLocation & Player::GetTeleportDest ( )
inline

◆ GetTemporaryUnsummonedPetNumber()

uint32 Player::GetTemporaryUnsummonedPetNumber ( ) const
inline

◆ GetTotalBaseModValue()

float Player::GetTotalBaseModValue ( BaseModGroup  modGroup) const
5106{
5107 if (modGroup >= BASEMOD_END)
5108 {
5109 LOG_ERROR("entities.player", "wrong BaseModGroup in GetTotalBaseModValue()!");
5110 return 0.0f;
5111 }
5112
5113 if (m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
5114 return 0.0f;
5115
5116 return m_auraBaseMod[modGroup][FLAT_MOD] * m_auraBaseMod[modGroup][PCT_MOD];
5117}

References BASEMOD_END, FLAT_MOD, LOG_ERROR, m_auraBaseMod, and PCT_MOD.

◆ GetTotalPercentageModValue()

float Player::GetTotalPercentageModValue ( BaseModGroup  modGroup) const
inline
2214{ return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }

References FLAT_MOD, m_auraBaseMod, and PCT_MOD.

Referenced by UpdateCritPercentage().

◆ GetTotalPlayedTime()

◆ GetTradeData()

◆ GetTrader()

Player * Player::GetTrader ( ) const
inline
1391{ return m_trade ? m_trade->GetTrader() : nullptr; }
Player * GetTrader() const
Definition TradeData.h:41

References TradeData::GetTrader(), and m_trade.

Referenced by WorldSession::moveItems(), and UpdatePosition().

◆ GetTrainerSpellState()

TrainerSpellState Player::GetTrainerSpellState ( TrainerSpell const *  trainer_spell) const
3923{
3924 if (!trainer_spell)
3925 return TRAINER_SPELL_RED;
3926
3927 bool hasSpell = true;
3928 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3929 {
3930 if (!trainer_spell->learnedSpell[i])
3931 continue;
3932
3933 if (!HasSpell(trainer_spell->learnedSpell[i]))
3934 {
3935 hasSpell = false;
3936 break;
3937 }
3938 }
3939 // known spell
3940 if (hasSpell)
3941 return TRAINER_SPELL_GRAY;
3942
3943 // check skill requirement
3944 if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
3945 return TRAINER_SPELL_RED;
3946
3947 // check level requirement
3948 if (GetLevel() < trainer_spell->reqLevel)
3949 return TRAINER_SPELL_RED;
3950
3951 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3952 {
3953 if (!trainer_spell->learnedSpell[i])
3954 continue;
3955
3956 // check race/class requirement
3957 if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
3958 return TRAINER_SPELL_RED;
3959
3960 if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->learnedSpell[i]))
3961 {
3962 // check prev.rank requirement
3963 if (prevSpell && !HasSpell(prevSpell))
3964 return TRAINER_SPELL_RED;
3965 }
3966
3967 SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(trainer_spell->learnedSpell[i]);
3968 for (SpellsRequiringSpellMap::const_iterator itr = spellsRequired.first; itr != spellsRequired.second; ++itr)
3969 {
3970 // check additional spell requirement
3971 if (!HasSpell(itr->second))
3972 return TRAINER_SPELL_RED;
3973 }
3974 }
3975
3976 // check primary prof. limit
3977 // first rank of primary profession spell when there are no proffesions avalible is disabled
3978 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3979 {
3980 if (!trainer_spell->learnedSpell[i])
3981 continue;
3982 SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->learnedSpell[i]);
3983 if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && (GetFreePrimaryProfessionPoints() == 0))
3985 }
3986
3987 return TRAINER_SPELL_GREEN;
3988}
@ TRAINER_SPELL_GREEN
Definition Player.h:214
@ TRAINER_SPELL_GRAY
Definition Player.h:216
@ TRAINER_SPELL_GREEN_DISABLED
Definition Player.h:217
@ TRAINER_SPELL_RED
Definition Player.h:215
std::pair< SpellsRequiringSpellMap::const_iterator, SpellsRequiringSpellMap::const_iterator > SpellsRequiringSpellMapBounds
Definition SpellMgr.h:570
bool IsSpellFitByClassAndRace(uint32 spell_id) const
Definition Player.cpp:12326

References GetBaseSkillValue(), GetFreePrimaryProfessionPoints(), Unit::GetLevel(), HasSpell(), SpellInfo::IsPrimaryProfessionFirstRank(), IsSpellFitByClassAndRace(), TrainerSpell::learnedSpell, MAX_SPELL_EFFECTS, TrainerSpell::reqLevel, TrainerSpell::reqSkill, TrainerSpell::reqSkillValue, sSpellMgr, TRAINER_SPELL_GRAY, TRAINER_SPELL_GREEN, TRAINER_SPELL_GREEN_DISABLED, and TRAINER_SPELL_RED.

Referenced by WorldSession::HandleTrainerBuySpellOpcode(), and WorldSession::SendTrainerList().

◆ GetUseableItemByPos()

Item * Player::GetUseableItemByPos ( uint8  bag,
uint8  slot 
) const
inline

◆ GetViewpoint()

WorldObject * Player::GetViewpoint ( ) const
13179{
13181 return static_cast<WorldObject*>(ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER));
13182 return nullptr;
13183}
@ TYPEMASK_SEER
Definition ObjectGuid.h:54
Definition Object.h:461
Object * GetObjectByTypeMask(WorldObject const &, ObjectGuid const guid, uint32 typemask)
Definition ObjectAccessor.cpp:141

References Object::GetGuidValue(), ObjectAccessor::GetObjectByTypeMask(), PLAYER_FARSIGHT, and TYPEMASK_SEER.

Referenced by CinematicMgr::EndCinematic(), WorldSession::HandleFarSightOpcode(), ArenaSpectator::HandleSpectatorWatchCommand(), RemoveFromWorld(), StopCastingBindSight(), and Map::Update().

◆ GetWeaponForAttack()

Item * Player::GetWeaponForAttack ( WeaponAttackType  attackType,
bool  useable = false 
) const
489{
490 uint8 slot;
491 switch (attackType)
492 {
493 case BASE_ATTACK:
495 break;
496 case OFF_ATTACK:
498 break;
499 case RANGED_ATTACK:
501 break;
502 default:
503 return nullptr;
504 }
505
506 Item* item = nullptr;
507 if (useable)
509 else
511 if (!item || item->GetTemplate()->Class != ITEM_CLASS_WEAPON)
512 return nullptr;
513
514 if (!useable)
515 return item;
516
517 if (item->IsBroken() || IsInFeralForm())
518 return nullptr;
519
520 return item;
521}

References BASE_ATTACK, ItemTemplate::Class, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetItemByPos(), Item::GetTemplate(), GetUseableItemByPos(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), Unit::IsInFeralForm(), ITEM_CLASS_WEAPON, OFF_ATTACK, and RANGED_ATTACK.

Referenced by AuraEffect::CalculateAmount(), CheckAmmoCompatibility(), Spell::CheckItems(), Spell::EffectEnchantItemTmp(), Spell::EffectWeaponDmg(), Unit::GetAPMultiplier(), GetBaseWeaponSkillValue(), GetMeleeDamageSchoolMask(), AuraEffect::HandleAuraModWeaponCritPercent(), AuraEffect::HandleModDamageDone(), AuraEffect::HandleModDamagePercentDone(), HasWeapon(), HasWeaponForAttack(), SetRegularAttackTime(), SetSheath(), Spell::Spell(), boss_viscidus::SpellHit(), Spell::TakeAmmo(), UpdateExpertise(), UpdateWeaponSkill(), and Spell::WriteAmmoToPacket().

◆ GetWeaponProficiency()

uint32 Player::GetWeaponProficiency ( ) const
inline
1376{ return m_WeaponProficiency; }

References m_WeaponProficiency.

Referenced by Spell::EffectProficiency().

◆ GetXPRestBonus()

uint32 Player::GetXPRestBonus ( uint32  xp)
8889{
8890 uint32 rested_bonus = (uint32)GetRestBonus(); // xp for each rested bonus
8891
8892 if (rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp
8893 rested_bonus = xp;
8894
8895 SetRestBonus(GetRestBonus() - rested_bonus);
8896
8897 LOG_DEBUG("entities.player", "Player gain {} xp (+ {} Rested Bonus). Rested points={}", xp + rested_bonus, rested_bonus, GetRestBonus());
8898 return rested_bonus;
8899}
void SetRestBonus(float restBonusNew)
Definition Player.cpp:10188
float GetRestBonus() const
Definition Player.h:1216

References GetRestBonus(), LOG_DEBUG, and SetRestBonus().

Referenced by GiveXP().

◆ GetZoneIdFromDB()

uint32 Player::GetZoneIdFromDB ( ObjectGuid  guid)
static
6351{
6352 ObjectGuid::LowType guidLow = guid.GetCounter();
6353
6355 stmt->SetData(0, guidLow);
6356 PreparedQueryResult result = CharacterDatabase.Query(stmt);
6357
6358 if (!result)
6359 return 0;
6360
6361 Field* fields = result->Fetch();
6362 uint32 zone = fields[0].Get<uint16>();
6363
6364 if (!zone)
6365 {
6366 // stored zone is zero, use generic and slow zone detection
6367 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
6368 stmt->SetData(0, guidLow);
6369 PreparedQueryResult posResult = CharacterDatabase.Query(stmt);
6370
6371 if (!posResult)
6372 {
6373 return 0;
6374 }
6375
6376 fields = posResult->Fetch();
6377 uint32 map = fields[0].Get<uint16>();
6378 float posx = fields[1].Get<float>();
6379 float posy = fields[2].Get<float>();
6380 float posz = fields[3].Get<float>();
6381
6382 if (!sMapStore.LookupEntry(map))
6383 return 0;
6384
6385 zone = sMapMgr->GetZoneId(PHASEMASK_NORMAL, map, posx, posy, posz);
6386
6387 if (zone > 0)
6388 {
6389 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE);
6390
6391 stmt->SetData(0, uint16(zone));
6392 stmt->SetData(1, guidLow);
6393
6394 CharacterDatabase.Execute(stmt);
6395 }
6396 }
6397
6398 return zone;
6399}
@ CHAR_SEL_CHAR_POSITION_XYZ
Definition CharacterDatabase.h:53
@ CHAR_UPD_ZONE
Definition CharacterDatabase.h:296
@ CHAR_SEL_CHAR_ZONE
Definition CharacterDatabase.h:51

References CHAR_SEL_CHAR_POSITION_XYZ, CHAR_SEL_CHAR_ZONE, CHAR_UPD_ZONE, CharacterDatabase, Field::Get(), ObjectGuid::GetCounter(), PHASEMASK_NORMAL, PreparedStatementBase::SetData(), sMapMgr, and sMapStore.

Referenced by Guild::Member::LoadFromDB().

◆ GiveLevel()

void Player::GiveLevel ( uint8  level)
Todo:
find some better solution
2461{
2462 uint8 oldLevel = GetLevel();
2463 if (level == oldLevel)
2464 return;
2465
2466 if (!sScriptMgr->OnPlayerCanGiveLevel(this, level))
2467 return;
2468
2469 if (Guild* guild = GetGuild())
2470 guild->UpdateMemberData(this, GUILD_MEMBER_DATA_LEVEL, level);
2471
2472 PlayerLevelInfo info;
2473 sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), level, &info);
2474
2475 PlayerClassLevelInfo classInfo;
2476 sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo);
2477
2479 packet.Level = level;
2480 packet.HealthDelta = int32(classInfo.basehealth) - int32(GetCreateHealth());
2481
2483 // for (int i = 0; i < MAX_POWERS; ++i)
2484 packet.PowerDelta[0] = int32(classInfo.basemana) - int32(GetCreateMana());
2485 packet.PowerDelta[1] = 0;
2486 packet.PowerDelta[2] = 0;
2487 packet.PowerDelta[3] = 0;
2488 packet.PowerDelta[4] = 0;
2489 packet.PowerDelta[5] = 0;
2490
2491 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2492 packet.StatDelta[i] = int32(info.stats[i]) - GetCreateStat(Stats(i));
2493
2494 SendDirectMessage(packet.Write());
2495
2496 SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(level));
2497
2498 //update level, max level of skills
2499 m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset
2500
2502
2503 SetLevel(level);
2504
2506
2507 // save base values (bonuses already included in stored stats
2508 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2509 SetCreateStat(Stats(i), info.stats[i]);
2510
2511 SetCreateHealth(classInfo.basehealth);
2512 SetCreateMana(classInfo.basemana);
2513
2517
2519
2520 if (sWorld->getBoolConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up
2522
2524
2525 if (!isDead())
2526 {
2527 // set current level health and mana/energy to maximum after applying all mods.
2528 SetFullHealth();
2535 }
2536
2537 // update level to hunter/summon pet
2538 if (Pet* pet = GetPet())
2539 pet->SynchronizeLevelWithOwner();
2540
2541 MailLevelReward const* mailReward = sObjectMgr->GetMailLevelReward(level, getRaceMask());
2542 if (mailReward && sScriptMgr->OnPlayerCanGiveMailRewardAtGiveLevel(this, level))
2543 {
2544 //- TODO: Poor design of mail system
2545 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2546 MailDraft(mailReward->mailTemplateId).SendMailTo(trans, this, MailSender(MAIL_CREATURE, mailReward->senderEntry));
2547 CharacterDatabase.CommitTransaction(trans);
2548 }
2549
2551
2552 // Refer-A-Friend
2553 if (GetSession()->GetRecruiterId())
2554 if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
2555 if (level % 2 == 0)
2556 {
2558
2559 if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01))
2561 }
2562
2564
2565 sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
2566}
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL
Definition DBCEnums.h:124
@ GUILD_MEMBER_DATA_LEVEL
Definition Guild.h:59
@ POWER_RAGE
Definition SharedDefines.h:270
@ POWER_HAPPINESS
Definition SharedDefines.h:273
@ POWER_ENERGY
Definition SharedDefines.h:272
@ POWER_FOCUS
Definition SharedDefines.h:271
@ PLAYER_NEXT_LEVEL_XP
Definition UpdateFields.h:340
@ CONFIG_ALWAYS_MAXSKILL
Definition WorldConfig.h:86
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition Object.cpp:938
void _ApplyAllLevelScaleItemMods(bool apply)
Definition Player.cpp:7625
void UpdateSkillsToMaxSkillsForLevel()
Definition PlayerUpdates.cpp:1130
Guild * GetGuild() const
Definition Player.cpp:15972
void UpdateSkillsForLevel()
Definition PlayerUpdates.cpp:1079
void SendQuestGiverStatusMultiple()
Definition Player.cpp:7702
void SetCreateStat(Stats stat, float val)
Definition Unit.h:1003
void SetCreateHealth(uint32 val)
Definition Unit.h:1051
void SetCreateMana(uint32 val)
Definition Unit.h:1073
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition Unit.cpp:15552
uint32 GetCreateHealth() const
Definition Unit.h:1035
uint32 GetCreateMana() const
Definition Unit.h:1072
bool isDead() const
Definition Unit.h:1709
Definition MiscPackets.h:45
uint32 Level
Definition MiscPackets.h:51
std::array< uint32, MAX_STATS > StatDelta
Definition MiscPackets.h:54
std::array< uint32, MAX_POWERS > PowerDelta
Definition MiscPackets.h:53
uint32 HealthDelta
Definition MiscPackets.h:52
WorldPacket const * Write() override
Definition MiscPackets.cpp:34
Definition ObjectMgr.h:543
uint32 senderEntry
Definition ObjectMgr.h:549
uint32 mailTemplateId
Definition ObjectMgr.h:548
Definition Player.h:295
uint32 basehealth
Definition Player.h:297
uint32 basemana
Definition Player.h:298
Definition Player.h:309
std::array< uint32, MAX_STATS > stats
Definition Player.h:315

References _ApplyAllLevelScaleItemMods(), ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL, PlayerClassLevelInfo::basehealth, PlayerClassLevelInfo::basemana, CharacterDatabase, CONFIG_ALWAYS_MAXSKILL, CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL, Unit::getClass(), Unit::GetCreateHealth(), Unit::GetCreateMana(), Unit::GetCreateStat(), GetGuild(), Unit::GetLevel(), Unit::GetMaxPower(), GetPet(), Unit::GetPower(), Unit::getRace(), Unit::getRaceMask(), GetSession(), GUILD_MEMBER_DATA_LEVEL, Object::HasByteFlag(), WorldPackets::Misc::LevelUpInfo::HealthDelta, InitGlyphsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), Unit::isDead(), WorldPackets::Misc::LevelUpInfo::Level, m_grantableLevels, m_Played_time, MAIL_CREATURE, MailLevelReward::mailTemplateId, MAX_STATS, PLAYED_TIME_LEVEL, PLAYER_FIELD_BYTES, PLAYER_NEXT_LEVEL_XP, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, WorldPackets::Misc::LevelUpInfo::PowerDelta, SendDirectMessage(), MailLevelReward::senderEntry, MailDraft::SendMailTo(), SendQuestGiverStatusMultiple(), Object::SetByteFlag(), Unit::SetCreateHealth(), Unit::SetCreateMana(), Unit::SetCreateStat(), Unit::SetFullHealth(), Unit::SetLevel(), Unit::SetPower(), Unit::SetUInt32Value(), sObjectMgr, sScriptMgr, STAT_STRENGTH, WorldPackets::Misc::LevelUpInfo::StatDelta, PlayerLevelInfo::stats, sWorld, UpdateAchievementCriteria(), UpdateAllStats(), UpdateSkillsForLevel(), UpdateSkillsToMaxSkillsForLevel(), and WorldPackets::Misc::LevelUpInfo::Write().

Referenced by GiveXP(), WorldSession::HandleAcceptGrantLevel(), and character_commandscript::HandleCharacterLevel().

◆ GiveQuestSourceItem()

bool Player::GiveQuestSourceItem ( Quest const *  quest)
1336{
1337 uint32 srcitem = quest->GetSrcItemId();
1338 if (srcitem > 0)
1339 {
1340 uint32 count = quest->GetSrcItemCount();
1341 if (count <= 0)
1342 count = 1;
1343
1344 ItemPosCountVec dest;
1345 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count);
1346 if (msg == EQUIP_ERR_OK)
1347 {
1348 Item* item = StoreNewItem(dest, srcitem, true);
1349 SendNewItem(item, count, true, false);
1350 return true;
1351 }
1352 // player already have max amount required item, just report success
1353 else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS)
1354 return true;
1355 else
1356 SendEquipError(msg, nullptr, nullptr, srcitem);
1357 return false;
1358 }
1359
1360 return true;
1361}

References CanStoreNewItem(), EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), NULL_BAG, NULL_SLOT, SendEquipError(), SendNewItem(), and StoreNewItem().

Referenced by AddQuest().

◆ GiveXP()

void Player::GiveXP ( uint32  xp,
Unit victim,
float  group_rate = 1.0f,
bool  isLFGReward = false 
)
2386{
2387 if (xp < 1)
2388 {
2389 return;
2390 }
2391
2392 if (!IsAlive() && !GetBattlegroundId() && !isLFGReward)
2393 {
2394 return;
2395 }
2396
2398 {
2399 return;
2400 }
2401
2402 if (victim && victim->IsCreature() && !victim->ToCreature()->hasLootRecipient())
2403 {
2404 return;
2405 }
2406
2407 uint8 level = GetLevel();
2408
2409 // Favored experience increase START
2410 uint32 zone = GetZoneId();
2411 float favored_exp_mult = 0;
2412 if ((zone == AREA_HELLFIRE_PENINSULA || zone == AREA_HELLFIRE_RAMPARTS || zone == AREA_MAGTHERIDONS_LAIR || zone == AREA_THE_BLOOD_FURNACE || zone == AREA_THE_SHATTERED_HALLS) && HasAnyAuras(32096 /*Thrallmar's Favor*/, 32098 /*Honor Hold's Favor*/))
2413 favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor
2414
2415 xp = uint32(xp * (1 + favored_exp_mult));
2416 // Favored experience increase END
2417
2418 // XP to money conversion processed in Player::RewardQuest
2419 if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2420 return;
2421
2422 uint32 bonus_xp = 0;
2423 bool recruitAFriend = GetsRecruitAFriendBonus(true);
2424
2425 // RaF does NOT stack with rested experience
2426 if (recruitAFriend)
2427 bonus_xp = 2 * xp; // xp + bonus_xp must add up to 3 * xp for RaF; calculation for quests done client-side
2428 else
2429 bonus_xp = victim ? GetXPRestBonus(xp) : 0; // XP resting bonus
2430
2431 // hooks and multipliers can modify the xp with a zero or negative value
2432 // check again before sending invalid xp to the client
2433 if (xp < 1)
2434 {
2435 return;
2436 }
2437
2438 SendLogXPGain(xp, victim, bonus_xp, recruitAFriend, group_rate);
2439
2442 uint32 newXP = curXP + xp + bonus_xp;
2443
2444 while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2445 {
2446 newXP -= nextLvlXP;
2447
2448 if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2449 GiveLevel(level + 1);
2450
2451 level = GetLevel();
2453 }
2454
2455 SetUInt32Value(PLAYER_XP, newXP);
2456}
@ AREA_THE_BLOOD_FURNACE
Definition AreaDefines.h:120
@ AREA_HELLFIRE_RAMPARTS
Definition AreaDefines.h:109
@ AREA_MAGTHERIDONS_LAIR
Definition AreaDefines.h:131
@ AREA_HELLFIRE_PENINSULA
Definition AreaDefines.h:98
@ AREA_THE_SHATTERED_HALLS
Definition AreaDefines.h:121
@ PLAYER_FLAGS_NO_XP_GAIN
Definition Player.h:505
bool hasLootRecipient() const
Definition Creature.h:235
bool IsCreature() const
Definition Object.h:205
void GiveLevel(uint8 level)
Definition Player.cpp:2460
uint32 GetXPRestBonus(uint32 xp)
Definition Player.cpp:8888
void SendLogXPGain(uint32 GivenXP, Unit *victim, uint32 BonusXP, bool recruitAFriend=false, float group_rate=1.0f)
Definition Player.cpp:2366
bool HasAnyAuras(Auras... spellIds) const
Checks if the unit has ANY specified auras.
Definition Unit.h:1395

References AREA_HELLFIRE_PENINSULA, AREA_HELLFIRE_RAMPARTS, AREA_MAGTHERIDONS_LAIR, AREA_THE_BLOOD_FURNACE, AREA_THE_SHATTERED_HALLS, CONFIG_MAX_PLAYER_LEVEL, GetBattlegroundId(), Unit::GetLevel(), GetsRecruitAFriendBonus(), Object::GetUInt32Value(), GetXPRestBonus(), WorldObject::GetZoneId(), GiveLevel(), Unit::HasAnyAuras(), Creature::hasLootRecipient(), HasPlayerFlag(), Unit::IsAlive(), Object::IsCreature(), PLAYER_FLAGS_NO_XP_GAIN, PLAYER_NEXT_LEVEL_XP, PLAYER_XP, SendLogXPGain(), Unit::SetUInt32Value(), sWorld, and Object::ToCreature().

Referenced by KillRewarder::_RewardXP(), CheckAreaExploreAndOutdoor(), RewardHonor(), and RewardQuest().

◆ GroupEventHappens()

void Player::GroupEventHappens ( uint32  questId,
WorldObject const *  pEventObject 
)
1819{
1820 if (Group* group = GetGroup())
1821 {
1822 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1823 {
1824 Player* player = itr->GetSource();
1825
1826 // for any leave or dead (with not released body) group member at appropriate distance
1827 if (player && player->IsAtGroupRewardDistance(pEventObject) && !player->GetCorpse())
1828 player->AreaExploredOrEventHappens(questId);
1829 }
1830 }
1831 else
1833}
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:12728
void AreaExploredOrEventHappens(uint32 questId)
Definition PlayerQuest.cpp:1791

References AreaExploredOrEventHappens(), GetCorpse(), GetGroup(), and IsAtGroupRewardDistance().

Referenced by SmartAI::EndPath(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_chapter2_persuasive_strike::HandleHit(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), Map::ScriptsProcess(), SmartAI::StopFollow(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_rinji::npc_rinjiAI::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_deathstalker_erland::npc_deathstalker_erlandAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached(), npc_gilthares::npc_giltharesAI::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_bonker_togglevolt::npc_bonker_togglevoltAI::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::WaypointReached(), npc_bessy::npc_bessyAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), npc_kservant::npc_kservantAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleBaseModValue()

void Player::HandleBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType,
float  amount,
bool  apply 
)
5052{
5053 if (modGroup >= BASEMOD_END)
5054 {
5055 LOG_ERROR("entities.player", "ERROR in HandleBaseModValue(): non existed BaseModGroup!");
5056 return;
5057 }
5058
5059 switch (modType)
5060 {
5061 case FLAT_MOD:
5062 m_auraBaseMod[modGroup][modType] += apply ? amount : -amount;
5063 break;
5064 case PCT_MOD:
5065 ApplyPercentModFloatVar(m_auraBaseMod[modGroup][modType], amount, apply);
5066 break;
5067 }
5068
5069 if (!CanModifyStats())
5070 return;
5071
5072 switch (modGroup)
5073 {
5074 case CRIT_PERCENTAGE:
5076 break;
5079 break;
5082 break;
5083 case SHIELD_BLOCK_VALUE:
5085 break;
5086 default:
5087 break;
5088 }
5089}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition Util.h:50
void UpdateShieldBlockValue()
Definition StatSystem.cpp:539
void UpdateCritPercentage(WeaponAttackType attType)
Definition StatSystem.cpp:658

References ApplyPercentModFloatVar(), BASE_ATTACK, BASEMOD_END, Unit::CanModifyStats(), CRIT_PERCENTAGE, FLAT_MOD, LOG_ERROR, m_auraBaseMod, OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, PCT_MOD, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, SHIELD_BLOCK_VALUE, UpdateCritPercentage(), and UpdateShieldBlockValue().

Referenced by _ApplyItemBonuses(), _ApplyWeaponDependentAuraCritMod(), ApplyEnchantment(), AuraEffect::HandleAuraModCritPct(), AuraEffect::HandleAuraModWeaponCritPercent(), and AuraEffect::HandleShieldBlockValue().

◆ HandleDrowning()

void Player::HandleDrowning ( uint32  time_diff)
protected
Todo:
: Check this formula
Todo:
: Check this formula
845{
847 return;
848
849 // In water
851 {
852 // Breath timer not activated - activate it
854 {
857 }
858 else // If activated - do tick
859 {
860 m_MirrorTimer[BREATH_TIMER] -= time_diff;
861 // Timer limit - need deal damage
863 {
865 // Calculate and deal damage
867 uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
869 }
870 else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need
872 }
873 }
874 else if (m_MirrorTimer[BREATH_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
875 {
876 int32 UnderWaterTime = getMaxTimer(BREATH_TIMER);
877 // Need breath regen
878 m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
879 if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
883 }
884
885 // In dark water
887 {
888 // Fatigue timer not activated - activate it
890 {
893 }
894 else
895 {
896 m_MirrorTimer[FATIGUE_TIMER] -= time_diff;
897 // Timer limit - need deal damage or teleport ghost to graveyard
899 {
901 if (IsAlive()) // Calculate and deal damage
902 {
903 uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
905 }
906 else if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard
908 }
911 }
912 }
913 else if (m_MirrorTimer[FATIGUE_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
914 {
915 int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
916 m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
917 if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
921 }
922
923 if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(_lastLiquid && _lastLiquid->SpellId))
924 {
925 // Breath timer not activated - activate it
928 else
929 {
930 m_MirrorTimer[FIRE_TIMER] -= time_diff;
931 if (m_MirrorTimer[FIRE_TIMER] < 0)
932 {
933 m_MirrorTimer[FIRE_TIMER] += 2020;
934 // Calculate and deal damage
936 uint32 damage = urand(600, 700);
939 // need to skip Slime damage in Undercity,
940 // maybe someone can find better way to handle environmental damage
941 //else if (m_zoneUpdateId != 1497)
942 // EnvironmentalDamage(DAMAGE_SLIME, damage);
943 }
944 }
945 }
946 else
948
949 // Recheck timers flag
950 m_MirrorTimerFlags &= ~UNDERWATER_EXIST_TIMERS;
951 for (uint8 i = 0; i < MAX_TIMERS; ++i)
953 {
955 break;
956 }
958}
@ DAMAGE_DROWNING
Definition Player.h:842
@ DAMAGE_EXHAUSTED
Definition Player.h:841
@ UNDERWATER_INDARKWATER
Definition Player.h:104
@ UNDERWATER_EXIST_TIMERS
Definition Player.h:106
@ UNDERWATER_INWATER
Definition Player.h:101
@ UNDERWATER_INLAVA
Definition Player.h:102
void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
Definition Player.cpp:741
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
Definition Player.cpp:764
void RepopAtGraveyard()
Definition Player.cpp:4952
int32 getMaxTimer(MirrorTimerType timer)
Definition Player.cpp:817
void StopMirrorTimer(MirrorTimerType Type)
Definition Player.cpp:752
LiquidTypeEntry const * _lastLiquid
Definition Unit.h:2115
uint32 SpellId
Definition DBCStructure.h:1290

References Unit::_lastLiquid, BREATH_TIMER, DAMAGE_DROWNING, DAMAGE_EXHAUSTED, DAMAGE_LAVA, DISABLED_MIRROR_TIMER, EnvironmentalDamage(), FATIGUE_TIMER, FIRE_TIMER, Unit::GetLevel(), Unit::GetMaxHealth(), getMaxTimer(), HasPlayerFlag(), IN_MILLISECONDS, Unit::IsAlive(), m_MirrorTimer, m_MirrorTimerFlags, m_MirrorTimerFlagsLast, MAX_TIMERS, PLAYER_FLAGS_GHOST, RepopAtGraveyard(), SendMirrorTimer(), LiquidTypeEntry::SpellId, StopMirrorTimer(), UNDERWATER_EXIST_TIMERS, UNDERWATER_INDARKWATER, UNDERWATER_INLAVA, UNDERWATER_INWATER, and urand().

Referenced by Update().

◆ HandleFall()

void Player::HandleFall ( MovementInfo const &  movementInfo)
13820{
13821 // calculate total z distance of the fall
13822 float z_diff = m_lastFallZ - movementInfo.pos.GetPositionZ();
13823
13824 //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
13825 // 14.57 can be calculated by resolving damageperc formula below to 0
13826 if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
13828 !HasFlyAura())
13829 {
13830 //Safe fall, fall height reduction
13832
13833 float damageperc = 0.018f * (z_diff - safe_fall) - 0.2426f;
13834 uint32 original_health = GetHealth(), final_damage = 0;
13835
13837 {
13838 uint32 damage = (uint32)(damageperc * GetMaxHealth() * sWorld->getRate(RATE_DAMAGE_FALL));
13839
13840 //float height = movementInfo.pos.m_positionZ;
13841 //UpdateGroundPositionZ(movementInfo.pos.m_positionX, movementInfo.pos.m_positionY, height);
13842
13843 if (damage > 0)
13844 {
13845 //Prevent fall damage from being more than the player maximum health
13846 if (damage > GetMaxHealth())
13847 damage = GetMaxHealth();
13848
13849 // Gust of Wind
13850 if (HasAura(43621))
13851 damage = GetMaxHealth() / 2;
13852
13853 // Divine Protection
13854 if (HasAura(498))
13855 {
13856 damage /= 2;
13857 }
13858
13859 final_damage = EnvironmentalDamage(DAMAGE_FALL, damage);
13860 }
13861
13862 //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
13863 LOG_DEBUG("entities.player", "FALLDAMAGE mZ={} z={} fallTime={} damage={} SF={}", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall);
13864 }
13865
13866 // recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case
13867 if (IsAlive() && final_damage < original_health)
13869 }
13870}
@ ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING
Definition DBCEnums.h:139
@ CHEAT_GOD
Definition Player.h:1006
@ SPELL_AURA_SAFE_FALL
Definition SpellAuraDefines.h:207
@ RATE_DAMAGE_FALL
Definition WorldConfig.h:457
bool GetCommandStatus(uint32 command) const
Definition Player.h:1200
bool HasFlyAura() const
Definition Unit.h:1717
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:12986

References ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, CHEAT_GOD, DAMAGE_FALL, EnvironmentalDamage(), MovementInfo::fallTime, GetCommandStatus(), Unit::GetHealth(), Unit::GetMaxHealth(), Position::GetPositionZ(), Unit::GetTotalAuraModifier(), Unit::HasAura(), Unit::HasFeatherFallAura(), Unit::HasFlyAura(), Unit::HasHoverAura(), Unit::IsAlive(), Unit::isDead(), IsGameMaster(), Unit::IsImmunedToDamageOrSchool(), LOG_DEBUG, m_lastFallZ, MovementInfo::pos, RATE_DAMAGE_FALL, SPELL_AURA_SAFE_FALL, SPELL_SCHOOL_MASK_NORMAL, sWorld, and UpdateAchievementCriteria().

Referenced by WorldSession::HandleMovementOpcodes().

◆ HandleSobering()

void Player::HandleSobering ( )
protected

The player sobers by 1% every 9 seconds.

962{
963 m_drunkTimer = 0;
964
965 uint8 currentDrunkValue = GetDrunkValue();
966 uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
967 SetDrunkValue(drunk);
968}
void SetDrunkValue(uint8 newDrunkValue, uint32 itemId=0)
Definition Player.cpp:981

References GetDrunkValue(), m_drunkTimer, and SetDrunkValue().

Referenced by Update().

◆ Has310Flyer()

bool Player::Has310Flyer ( bool  checkAllSpells,
uint32  excludeSpellId = 0 
)
3511{
3512 if (!checkAllSpells)
3514 else
3515 {
3516 SetHas310Flyer(false);
3517 SpellInfo const* spellInfo;
3518 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
3519 {
3520 // pussywizard:
3521 if (itr->second->State == PLAYERSPELL_REMOVED)
3522 continue;
3523
3524 if (itr->first == excludeSpellId)
3525 continue;
3526
3527 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(itr->first);
3528 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
3529 {
3530 if (_spell_idx->second->SkillLine != SKILL_MOUNTS)
3531 break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
3532
3533 spellInfo = sSpellMgr->AssertSpellInfo(itr->first);
3534 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3535 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
3536 spellInfo->Effects[i].CalcValue() == 310)
3537 {
3538 SetHas310Flyer(true);
3539 return true;
3540 }
3541 }
3542 }
3543 }
3544
3545 return false;
3546}
@ PLAYER_EXTRA_HAS_310_FLYER
Definition Player.h:596

References SpellInfo::Effects, m_ExtraFlags, m_spells, MAX_SPELL_EFFECTS, PLAYER_EXTRA_HAS_310_FLYER, PLAYERSPELL_REMOVED, SetHas310Flyer(), SKILL_MOUNTS, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, and sSpellMgr.

Referenced by _addSpell(), and removeSpell().

◆ HasAchieved()

bool Player::HasAchieved ( uint32  achievementId) const

◆ HasActivePowerType()

bool Player::HasActivePowerType ( Powers  power)
overridevirtual

Reimplemented from Unit.

2757{
2758 if (sScriptMgr->OnPlayerHasActivePowerType(this, power))
2759 return true;
2760 else
2761 return (getPowerType() == power);
2762}

References Unit::getPowerType(), and sScriptMgr.

Referenced by Create(), and ResetAllPowers().

◆ HasActiveSpell()

bool Player::HasActiveSpell ( uint32  spell) const
3917{
3918 PlayerSpellMap::const_iterator itr = m_spells.find(spell);
3919 return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active && itr->second->IsInSpec(m_activeSpec));
3920}

References m_activeSpec, m_spells, and PLAYERSPELL_REMOVED.

Referenced by _AddSpellCooldown(), ActivateSpec(), spell_dk_dancing_rune_weapon::CheckProc(), WorldSession::HandleCastSpellOpcode(), and learnSpell().

◆ HasAtLoginFlag()

◆ HasCasterSpec()

bool Player::HasCasterSpec ( )
16077{
16078 switch (GetSpec(GetActiveSpec()))
16079 {
16092 return true;
16093 default:
16094 break;
16095 }
16096 return false;
16097}
@ TALENT_TREE_HUNTER_SURVIVAL
Definition Player.h:153
@ TALENT_TREE_MAGE_FIRE
Definition Player.h:167
@ TALENT_TREE_PRIEST_SHADOW
Definition Player.h:159
@ TALENT_TREE_SHAMAN_ELEMENTAL
Definition Player.h:163
@ TALENT_TREE_HUNTER_BEAST_MASTERY
Definition Player.h:151
@ TALENT_TREE_WARLOCK_DEMONOLOGY
Definition Player.h:170
@ TALENT_TREE_WARLOCK_DESTRUCTION
Definition Player.h:171
@ TALENT_TREE_WARLOCK_AFFLICTION
Definition Player.h:169
@ TALENT_TREE_MAGE_ARCANE
Definition Player.h:166
@ TALENT_TREE_MAGE_FROST
Definition Player.h:168
@ TALENT_TREE_DRUID_BALANCE
Definition Player.h:172
@ TALENT_TREE_HUNTER_MARKSMANSHIP
Definition Player.h:152
uint32 GetSpec(int8 spec=-1)
Definition Player.cpp:15978

References GetActiveSpec(), GetSpec(), TALENT_TREE_DRUID_BALANCE, TALENT_TREE_HUNTER_BEAST_MASTERY, TALENT_TREE_HUNTER_MARKSMANSHIP, TALENT_TREE_HUNTER_SURVIVAL, TALENT_TREE_MAGE_ARCANE, TALENT_TREE_MAGE_FIRE, TALENT_TREE_MAGE_FROST, TALENT_TREE_PRIEST_SHADOW, TALENT_TREE_SHAMAN_ELEMENTAL, TALENT_TREE_WARLOCK_AFFLICTION, TALENT_TREE_WARLOCK_DEMONOLOGY, and TALENT_TREE_WARLOCK_DESTRUCTION.

◆ HasCorpse()

◆ HasDelayedTeleport()

bool Player::HasDelayedTeleport ( ) const
inlineprivate
2968{ return m_bHasDelayedTeleport; }

References m_bHasDelayedTeleport.

Referenced by Update().

◆ HasEnoughMoney() [1/2]

bool Player::HasEnoughMoney ( int32  amount) const
inline
1625 {
1626 if (amount > 0)
1627 return (GetMoney() >= (uint32) amount);
1628 return true;
1629 }

References GetMoney().

◆ HasEnoughMoney() [2/2]

◆ HasFreeBattlegroundQueueId()

bool Player::HasFreeBattlegroundQueueId ( ) const

◆ HasHealSpec()

bool Player::HasHealSpec ( )
16100{
16101 switch (GetSpec(GetActiveSpec()))
16102 {
16108 return true;
16109 default:
16110 break;
16111 }
16112 return false;
16113}
@ TALENT_TREE_DRUID_RESTORATION
Definition Player.h:174
@ TALENT_TREE_SHAMAN_RESTORATION
Definition Player.h:165
@ TALENT_TREE_PRIEST_HOLY
Definition Player.h:158
@ TALENT_TREE_PALADIN_HOLY
Definition Player.h:148
@ TALENT_TREE_PRIEST_DISCIPLINE
Definition Player.h:157

References GetActiveSpec(), GetSpec(), TALENT_TREE_DRUID_RESTORATION, TALENT_TREE_PALADIN_HOLY, TALENT_TREE_PRIEST_DISCIPLINE, TALENT_TREE_PRIEST_HOLY, and TALENT_TREE_SHAMAN_RESTORATION.

◆ HasItemCount()

bool Player::HasItemCount ( uint32  item,
uint32  count = 1,
bool  inBankAlso = false 
) const
656{
657 uint32 tempcount = 0;
659 {
661 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
662 {
663 tempcount += pItem->GetCount();
664 if (tempcount >= count)
665 return true;
666 }
667 }
669 {
671 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
672 {
673 tempcount += pItem->GetCount();
674 if (tempcount >= count)
675 return true;
676 }
677 }
679 {
680 if (Bag* pBag = GetBagByPos(i))
681 {
682 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
683 {
684 Item* pItem = GetItemByPos(i, j);
685 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
686 {
687 tempcount += pItem->GetCount();
688 if (tempcount >= count)
689 return true;
690 }
691 }
692 }
693 }
694
695 if (inBankAlso)
696 {
698 {
700 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
701 {
702 tempcount += pItem->GetCount();
703 if (tempcount >= count)
704 return true;
705 }
706 }
708 {
709 if (Bag* pBag = GetBagByPos(i))
710 {
711 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
712 {
713 Item* pItem = GetItemByPos(i, j);
714 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
715 {
716 tempcount += pItem->GetCount();
717 if (tempcount >= count)
718 return true;
719 }
720 }
721 }
722 }
723 }
724
725 return false;
726}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, Item::IsInTrade(), and KEYRING_SLOT_START.

Referenced by LootItem::AllowedForPlayer(), BuyItemFromVendorSlot(), CanCompleteRepeatableQuest(), Spell::CheckItems(), spell_dk_raise_dead::CheckReagents(), Spell::EffectCreateItem2(), GetResurrectionSpellId(), go_soulwell::go_soulwellAI::GossipHello(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::GossipHello(), misc_commandscript::HandleAddItemCommand(), lfg::LFGMgr::InitializeLockedDungeons(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_lokhtos_darkbargainer::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), npc_locksmith::OnGossipHello(), npc_oculus_drakegiver::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), AreaTrigger_at_voltarus_middle::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_twilight_grove::OnTrigger(), NPCStaveQuestAI::QuestIncomplete(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), Satisfy(), npc_aquementas::npc_aquementasAI::SendItem(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and Spell::WriteCastResultInfo().

◆ HasItemFitToSpellRequirements()

bool Player::HasItemFitToSpellRequirements ( SpellInfo const *  spellInfo,
Item const *  ignoreItem = nullptr 
) const
12488{
12489 if (spellInfo->EquippedItemClass < 0)
12490 return true;
12491
12492 // scan other equipped items for same requirements (mostly 2 daggers/etc)
12493 // for optimize check 2 used cases only
12494 switch (spellInfo->EquippedItemClass)
12495 {
12496 case ITEM_CLASS_WEAPON:
12497 {
12500 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12501 return true;
12502 break;
12503 }
12504 case ITEM_CLASS_ARMOR:
12505 {
12506 // tabard not have dependent spells
12509 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12510 return true;
12511
12512 // shields can be equipped to offhand slot
12514 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12515 return true;
12516
12517 // ranged slot can have some armor subclasses
12519 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12520 return true;
12521
12522 break;
12523 }
12524 default:
12525 LOG_ERROR("entities.player", "HasItemFitToSpellRequirements: Not handled spell requirement for item class {}", spellInfo->EquippedItemClass);
12526 break;
12527 }
12528
12529 return false;
12530}

References EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, SpellInfo::EquippedItemClass, GetUseableItemByPos(), INVENTORY_SLOT_BAG_0, Item::IsFitToSpellRequirements(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, and LOG_ERROR.

Referenced by Unit::CalcArmorReducedDamage(), Spell::CheckItems(), and RemoveItemDependentAurasAndCasts().

◆ HasItemOrGemWithIdEquipped()

bool Player::HasItemOrGemWithIdEquipped ( uint32  item,
uint32  count,
uint8  except_slot = NULL_SLOT 
) const
729{
730 uint32 tempcount = 0;
732 {
733 if (i == except_slot)
734 continue;
735
737 if (pItem && pItem->GetEntry() == item)
738 {
739 tempcount += pItem->GetCount();
740 if (tempcount >= count)
741 return true;
742 }
743 }
744
745 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
746 if (pProto && pProto->GemProperties)
747 {
749 {
750 if (i == except_slot)
751 continue;
752
754 if (pItem && pItem->GetTemplate()->Socket[0].Color)
755 {
756 tempcount += pItem->GetGemCountWithID(item);
757 if (tempcount >= count)
758 return true;
759 }
760 }
761 }
762
763 return false;
764}
uint8 GetGemCountWithID(uint32 GemID) const
Definition Item.cpp:1014

References _Socket::Color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, ItemTemplate::GemProperties, Item::GetCount(), Object::GetEntry(), Item::GetGemCountWithID(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, sObjectMgr, and ItemTemplate::Socket.

Referenced by npc_eris_hevenfire::npc_eris_hevenfireAI::CanBeSeen(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::CanBeSeen(), CanEquipUniqueItem(), achievement_pb_pilgrims_peril::OnCheck(), and achievement_pb_terokkar_turkey_time::OnCheck().

◆ HasItemOrGemWithLimitCategoryEquipped()

bool Player::HasItemOrGemWithLimitCategoryEquipped ( uint32  limitCategory,
uint32  count,
uint8  except_slot = NULL_SLOT 
) const
767{
768 uint32 tempcount = 0;
770 {
771 if (i == except_slot)
772 continue;
773
775 if (!pItem)
776 continue;
777
778 ItemTemplate const* pProto = pItem->GetTemplate();
779 if (!pProto)
780 continue;
781
782 if (pProto->ItemLimitCategory == limitCategory)
783 {
784 tempcount += pItem->GetCount();
785 if (tempcount >= count)
786 return true;
787 }
788
790 {
791 tempcount += pItem->GetGemCountWithLimitCategory(limitCategory);
792 if (tempcount >= count)
793 return true;
794 }
795 }
796
797 return false;
798}

References _Socket::Color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetCount(), Item::GetEnchantmentId(), Item::GetGemCountWithLimitCategory(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemTemplate::ItemLimitCategory, PRISMATIC_ENCHANTMENT_SLOT, and ItemTemplate::Socket.

Referenced by CanEquipUniqueItem().

◆ HasItemTotemCategory()

bool Player::HasItemTotemCategory ( uint32  TotemCategory) const
852{
853 Item* pItem;
855 {
858 return true;
859 }
861 {
864 return true;
865 }
867 {
868 if (Bag* pBag = GetBagByPos(i))
869 {
870 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
871 {
872 pItem = GetItemByPos(i, j);
874 return true;
875 }
876 }
877 }
878 return false;
879}
TotemCategory
Definition SharedDefines.h:3322
bool IsTotemCategoryCompatiableWith(ItemTemplate const *pProto, uint32 requiredTotemCategoryId) const
Definition PlayerStorage.cpp:881

References CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, IsTotemCategoryCompatiableWith(), and KEYRING_SLOT_START.

Referenced by Spell::CheckItems().

◆ HasMeleeSpec()

bool Player::HasMeleeSpec ( )
16054{
16055 switch (GetSpec(GetActiveSpec()))
16056 {
16066 return true;
16068 if (GetShapeshiftForm() == FORM_CAT)
16069 return true;
16070 default:
16071 break;
16072 }
16073 return false;
16074}
@ TALENT_TREE_DEATH_KNIGHT_FROST
Definition Player.h:161
@ TALENT_TREE_DRUID_FERAL_COMBAT
Definition Player.h:173
@ TALENT_TREE_WARRIOR_FURY
Definition Player.h:146
@ TALENT_TREE_ROGUE_ASSASSINATION
Definition Player.h:154
@ TALENT_TREE_DEATH_KNIGHT_UNHOLY
Definition Player.h:162
@ TALENT_TREE_SHAMAN_ENHANCEMENT
Definition Player.h:164
@ TALENT_TREE_WARRIOR_ARMS
Definition Player.h:145
@ TALENT_TREE_ROGUE_COMBAT
Definition Player.h:155
@ TALENT_TREE_PALADIN_RETRIBUTION
Definition Player.h:150
@ TALENT_TREE_ROGUE_SUBTLETY
Definition Player.h:156
@ FORM_CAT
Definition UnitDefines.h:70

References FORM_CAT, GetActiveSpec(), Unit::GetShapeshiftForm(), GetSpec(), TALENT_TREE_DEATH_KNIGHT_FROST, TALENT_TREE_DEATH_KNIGHT_UNHOLY, TALENT_TREE_DRUID_FERAL_COMBAT, TALENT_TREE_PALADIN_RETRIBUTION, TALENT_TREE_ROGUE_ASSASSINATION, TALENT_TREE_ROGUE_COMBAT, TALENT_TREE_ROGUE_SUBTLETY, TALENT_TREE_SHAMAN_ENHANCEMENT, TALENT_TREE_WARRIOR_ARMS, and TALENT_TREE_WARRIOR_FURY.

◆ HasPendingBind()

◆ HasPendingSpectatorForBG()

bool Player::HasPendingSpectatorForBG ( uint32  bgInstanceId) const
inline
2596{ return m_pendingSpectatorForBG == bgInstanceId; }

References m_pendingSpectatorForBG.

Referenced by WorldSession::HandleMoveWorldportAck(), and TeleportTo().

◆ HasPlayerFlag()

◆ HasPvPForcingQuest()

bool Player::HasPvPForcingQuest ( ) const
2496{
2497 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2498 {
2499 uint32 questId = GetQuestSlotQuestId(i);
2500 if (questId == 0)
2501 continue;
2502
2503 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
2504 if (!quest)
2505 continue;
2506
2507 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
2508 return true;
2509 }
2510
2511 return false;
2512}

References GetQuestSlotQuestId(), Quest::HasFlag(), MAX_QUEST_LOG_SIZE, QUEST_FLAGS_FLAGS_PVP, and sObjectMgr.

Referenced by Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), RewardQuest(), and UpdateZone().

◆ HasQuest()

bool Player::HasQuest ( uint32  questId) const
102{
103 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
104 {
105 uint32 questid = GetQuestSlotQuestId(i);
106 if (questid == questId)
107 {
108 return true;
109 }
110 }
111
112 return false;
113}

References GetQuestSlotQuestId(), and MAX_QUEST_LOG_SIZE.

Referenced by spell_portal_effect_acherus::CheckCast().

◆ HasQuestForGO()

bool Player::HasQuestForGO ( int32  GOId) const
12352{
12353 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
12354 {
12355 uint32 questid = GetQuestSlotQuestId(i);
12356 if (questid == 0)
12357 continue;
12358
12359 QuestStatusMap::const_iterator qs_itr = m_QuestStatus.find(questid);
12360 if (qs_itr == m_QuestStatus.end())
12361 continue;
12362
12363 QuestStatusData const& qs = qs_itr->second;
12364
12366 {
12367 Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
12368 if (!qinfo)
12369 continue;
12370
12371 if (GetGroup() && GetGroup()->isRaidGroup() && !qinfo->IsAllowedInRaid(GetMap()->GetDifficulty()))
12372 continue;
12373
12374 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
12375 {
12376 if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case
12377 continue;
12378
12379 if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.CreatureOrGOCount[j] < qinfo->RequiredNpcOrGoCount[j])
12380 return true;
12381 }
12382 }
12383 }
12384 return false;
12385}
Difficulty GetDifficulty(bool isRaid) const
Definition Player.h:1933
bool IsAllowedInRaid(Difficulty difficulty) const
Definition QuestDef.cpp:296

References QuestStatusData::CreatureOrGOCount, GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), Quest::IsAllowedInRaid(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, sObjectMgr, and QuestStatusData::Status.

Referenced by GameObject::ActivateToQuest().

◆ HasQuestForItem()

bool Player::HasQuestForItem ( uint32  itemId,
uint32  excludeQuestId = 0,
bool  turnIn = false,
bool *  showInLoot = nullptr 
) const
2265{
2266 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2267 {
2268 uint32 questid = GetQuestSlotQuestId(i);
2269 if (questid == 0 || questid == excludeQuestId)
2270 continue;
2271
2272 QuestStatusMap::const_iterator qs_itr = m_QuestStatus.find(questid);
2273 if (qs_itr == m_QuestStatus.end())
2274 continue;
2275
2276 QuestStatusData const& q_status = qs_itr->second;
2277
2278 if ((q_status.Status == QUEST_STATUS_INCOMPLETE) || (turnIn && q_status.Status == QUEST_STATUS_COMPLETE))
2279 {
2280 Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
2281 if (!qinfo)
2282 continue;
2283
2284 // hide quest if player is in raid-group and quest is no raid quest
2285 if (GetGroup() && GetGroup()->isRaidGroup() && !qinfo->IsAllowedInRaid(GetMap()->GetDifficulty()))
2286 {
2287 if (!InBattleground() && !GetGroup()->isBFGroup()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
2288 {
2289 continue;
2290 }
2291 }
2292
2293 // There should be no mixed ReqItem/ReqSource drop
2294 // This part for ReqItem drop
2295 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
2296 {
2297 if (itemid == qinfo->RequiredItemId[j] && q_status.ItemCount[j] < qinfo->RequiredItemCount[j])
2298 {
2299 if (showInLoot)
2300 {
2301 if (GetItemCount(itemid, true) < qinfo->RequiredItemCount[j])
2302 {
2303 return true;
2304 }
2305
2306 *showInLoot = false;
2307 }
2308 else
2309 {
2310 return true;
2311 }
2312 }
2313
2314 if (turnIn && q_status.ItemCount[j] >= qinfo->RequiredItemCount[j])
2315 {
2316 return true;
2317 }
2318 }
2319 // This part - for ReqSource
2320 for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
2321 {
2322 // examined item is a source item
2323 if (qinfo->ItemDrop[j] == itemid)
2324 {
2325 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
2326 uint32 ownedCount = GetItemCount(itemid, true);
2327 // 'unique' item
2328 if ((pProto->MaxCount && int32(ownedCount) < pProto->MaxCount) || (turnIn && int32(ownedCount) >= pProto->MaxCount))
2329 return true;
2330
2331 // allows custom amount drop when not 0
2332 if (qinfo->ItemDropQuantity[j])
2333 {
2334 if ((ownedCount < qinfo->ItemDropQuantity[j]) || (turnIn && ownedCount >= qinfo->ItemDropQuantity[j]))
2335 return true;
2336 }
2337 else if (ownedCount < pProto->GetMaxStackSize())
2338 return true;
2339 }
2340 }
2341 }
2342 }
2343 return false;
2344}
uint32 ItemDropQuantity[QUEST_SOURCE_ITEM_IDS_COUNT]
Definition QuestDef.h:303
uint32 ItemDrop[QUEST_SOURCE_ITEM_IDS_COUNT]
Definition QuestDef.h:302
uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT]
Definition QuestDef.h:300

References GetDifficulty(), GetGroup(), GetItemCount(), WorldObject::GetMap(), GetQuestSlotQuestId(), InBattleground(), Quest::IsAllowedInRaid(), QuestStatusData::ItemCount, Quest::ItemDrop, Quest::ItemDropQuantity, m_QuestStatus, MAX_QUEST_LOG_SIZE, ItemTemplate::MaxCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, and QuestStatusData::Status.

Referenced by LootItem::AllowedForPlayer(), LootTemplate::HasQuestDropForPlayer(), LootTemplate::LootGroup::HasQuestDropForPlayer(), at_twilight_grove::OnTrigger(), and RewardQuest().

◆ HasReceivedSpectatorResetFor()

bool Player::HasReceivedSpectatorResetFor ( ObjectGuid  guid)
inline

◆ HasRestFlag()

bool Player::HasRestFlag ( RestFlag  restFlag) const
inline
1219{ return (_restFlagMask & restFlag) != 0; }

References _restFlagMask.

Referenced by Update().

◆ HasSkill()

◆ hasSpanishClient()

bool Player::hasSpanishClient ( )
inline
1105 {
1107 }
@ LOCALE_esES
Definition Common.h:124
@ LOCALE_esMX
Definition Common.h:125
LocaleConstant GetSessionDbLocaleIndex() const
Definition WorldSession.h:517

References GetSession(), WorldSession::GetSessionDbLocaleIndex(), LOCALE_esES, and LOCALE_esMX.

◆ HasSpell()

bool Player::HasSpell ( uint32  spell) const
overridevirtual

Reimplemented from Unit.

3905{
3906 PlayerSpellMap::const_iterator itr = m_spells.find(spell);
3907 return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec));
3908}

References m_activeSpec, m_spells, and PLAYERSPELL_REMOVED.

Referenced by ActivateSpec(), AddSpellAndCategoryCooldowns(), LootItem::AllowedForPlayer(), canCreateExtraItems(), CanCreatePerfectItem(), canFlyInZone(), Group::CanJoinBattlegroundQueue(), npc_engineering_tele_trinket::CanLearn(), CanResummonPet(), CanRollForItemInLFG(), CanUseItem(), Spell::EffectCastButtons(), GetExplicitDiscoverySpell(), GetResurrectionSpellId(), GetSkillDiscoverySpell(), GetStartPosition(), GetTrainerSpellState(), WorldSession::HandleBattlemasterJoinOpcode(), Acore::PlayerCommand::HandleLearnSpellCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleTrainerBuySpellOpcode(), Acore::PlayerCommand::HandleUnlearnSpellCommand(), npc_prof_alchemy::HasAlchemySpell(), HasDiscoveredAllSpells(), npc_prof_leather::HasLeatherSpecialty(), go_evil_book_for_dummies::HasLeatherSpecialty(), npc_prof_tailor::HasTailorSpell(), npc_prof_blacksmith::HasWeaponSub(), IsActionButtonDataValid(), Creature::IsValidTrainerForPlayer(), learnQuestRewardedSpells(), boss_gloomrel::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), ProcessCastaction(), resetTalents(), WorldSession::SendTrainerList(), and TeleportTo().

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

bool Player::HasSpellItemCooldown ( uint32  spell_id,
uint32  itemid 
) const
overridevirtual

Reimplemented from Unit.

16307{
16308 SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
16309 return itr != m_spellCooldowns.end() && itr->second.end > getMSTime() && itr->second.itemid == itemid;
16310}

References getMSTime(), and m_spellCooldowns.

◆ HasSpellMod()

bool Player::HasSpellMod ( SpellModifier mod,
Spell spell 
)
9748{
9749 if (!mod || !spell)
9750 return false;
9751
9752 return spell->m_appliedMods.find(mod->ownerAura) != spell->m_appliedMods.end();
9753}

References Spell::m_appliedMods, and SpellModifier::ownerAura.

Referenced by ApplySpellMod().

◆ HasTalent()

bool Player::HasTalent ( uint32  spell_id,
uint8  spec 
) const
3911{
3912 PlayerTalentMap::const_iterator itr = m_talents.find(spell);
3913 return (itr != m_talents.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec));
3914}

References m_activeSpec, m_talents, and PLAYERSPELL_REMOVED.

Referenced by ActivateSpec(), GetSpec(), AuraEffect::HandleShapeshiftBoosts(), and LearnTalent().

◆ HasTankSpec()

bool Player::HasTankSpec ( )
16036{
16037 switch (GetSpec())
16038 {
16042 return true;
16045 return true;
16046 break;
16047 default:
16048 break;
16049 }
16050 return false;
16051}
@ TALENT_TREE_DEATH_KNIGHT_BLOOD
Definition Player.h:160
@ TALENT_TREE_PALADIN_PROTECTION
Definition Player.h:149
@ TALENT_TREE_WARRIOR_PROTECTION
Definition Player.h:147
@ FORM_DIREBEAR
Definition UnitDefines.h:77
@ FORM_BEAR
Definition UnitDefines.h:74

References FORM_BEAR, FORM_DIREBEAR, Unit::GetShapeshiftForm(), GetSpec(), TALENT_TREE_DEATH_KNIGHT_BLOOD, TALENT_TREE_DRUID_FERAL_COMBAT, TALENT_TREE_PALADIN_PROTECTION, and TALENT_TREE_WARRIOR_PROTECTION.

◆ HasTitle() [1/2]

bool Player::HasTitle ( CharTitlesEntry const *  title) const
inline
2559{ return HasTitle(title->bit_index); }
bool HasTitle(uint32 bitIndex) const
Definition Player.cpp:13291

References CharTitlesEntry::bit_index, and HasTitle().

Referenced by HasTitle().

◆ HasTitle() [2/2]

bool Player::HasTitle ( uint32  bitIndex) const
13292{
13293 if (bitIndex > MAX_TITLE_INDEX)
13294 return false;
13295
13296 uint32 fieldIndexOffset = bitIndex / 32;
13297 uint32 flag = 1 << (bitIndex % 32);
13298 return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13299}
#define MAX_TITLE_INDEX
Definition Player.h:560

References Object::HasFlag(), MAX_TITLE_INDEX, and PLAYER__FIELD_KNOWN_TITLES.

Referenced by character_commandscript::HandleCharacterTitlesCommand(), lookup_commandscript::HandleLookupTitleCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), LoadFromDB(), and AchievementCriteriaData::Meets().

◆ HasWeapon()

bool Player::HasWeapon ( WeaponAttackType  type) const
inlineoverridevirtual

Implements Unit.

1273{ return GetWeaponForAttack(type, false); }

References GetWeaponForAttack().

◆ HasWeaponForAttack()

bool Player::HasWeaponForAttack ( WeaponAttackType  type) const
inlineoverridevirtual

Reimplemented from Unit.

1274{ return (Unit::HasWeaponForAttack(type) && GetWeaponForAttack(type, true)); }
virtual bool HasWeaponForAttack(WeaponAttackType type) const
Definition Unit.h:927

References GetWeaponForAttack(), and Unit::HasWeaponForAttack().

◆ HaveAtClient() [1/2]

bool Player::HaveAtClient ( ObjectGuid  guid) const
11403{
11404 if (guid == GetGUID())
11405 return true;
11406
11408}
VisibleWorldObjectsMap * GetVisibleWorldObjectsMap()
Definition ObjectVisibilityContainer.h:59

References Object::GetGUID(), WorldObject::GetObjectVisibilityContainer(), and ObjectVisibilityContainer::GetVisibleWorldObjectsMap().

◆ HaveAtClient() [2/2]

bool Player::HaveAtClient ( WorldObject const *  u) const
11391{
11392 // Motion Transports are always present in player's client
11393 if (GameObject const* gameobject = u->ToGameObject())
11394 {
11395 if (gameobject->IsMotionTransport())
11396 return true;
11397 }
11398
11399 return HaveAtClient(u->GetGUID());
11400}
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11390

References Object::GetGUID(), HaveAtClient(), and Object::ToGameObject().

Referenced by Group::AddMember(), ArenaSpectator::HandleSpectatorWatchCommand(), HaveAtClient(), Map::SendInitSelf(), Acore::MessageDistDeliverer::SendPacket(), Acore::MessageDistDelivererToHostile::SendPacket(), Unit::SetOwnerGUID(), UpdateVisibilityOf(), and UpdateVisibilityOf().

◆ InArena()

bool Player::InArena ( ) const
12267{
12269 if (!bg || !bg->isArena())
12270 return false;
12271
12272 return true;
12273}
bool isArena() const
Definition Battleground.h:404

References GetBattleground(), and Battleground::isArena().

Referenced by CreateCorpse(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleUseItemOpcode(), achievement_arena_by_type::OnCheck(), RewardHonor(), and AuraEffect::UpdatePeriodic().

◆ InBattleground()

◆ InBattlegroundQueue()

bool Player::InBattlegroundQueue ( bool  ignoreArena = false) const

◆ InBattlegroundQueueForBattlegroundQueueType()

bool Player::InBattlegroundQueueForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId) const
12209{
12211}
uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
Definition Player.cpp:12190

References GetBattlegroundQueueIndex(), and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by Group::CanJoinBattlegroundQueue(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ IncompleteQuest()

◆ InitDataForForm()

void Player::InitDataForForm ( bool  reapplyMods = false)
10551{
10553
10554 SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
10555 if (ssEntry && ssEntry->attackSpeed)
10556 {
10560 }
10561 else
10563
10564 switch (form)
10565 {
10566 case FORM_GHOUL:
10567 case FORM_CAT:
10568 {
10569 if (getPowerType() != POWER_ENERGY)
10571 break;
10572 }
10573 case FORM_BEAR:
10574 case FORM_DIREBEAR:
10575 {
10576 if (getPowerType() != POWER_RAGE)
10578 break;
10579 }
10580 default: // 0, for example
10581 {
10582 ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass());
10583 if (cEntry && cEntry->powerType < MAX_POWERS && uint32(getPowerType()) != cEntry->powerType)
10584 setPowerType(Powers(cEntry->powerType));
10585 break;
10586 }
10587 }
10588
10589 // update auras at form change, ignore this at mods reapply (.reset stats/etc) when form not change.
10590 if (!reapplyMods)
10592
10595}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
ShapeshiftForm
Definition UnitDefines.h:68
@ FORM_GHOUL
Definition UnitDefines.h:76
void SetRegularAttackTime()
Definition Player.cpp:5326
void UpdateEquipSpellsAtFormChange()
Definition PlayerUpdates.cpp:1359
void setPowerType(Powers power)
Definition Unit.cpp:10040
Definition DBCStructure.h:1818
uint32 attackSpeed
Definition DBCStructure.h:1826

References SpellShapeshiftFormEntry::attackSpeed, BASE_ATTACK, BASE_ATTACK_TIME, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_GHOUL, Unit::getClass(), Unit::getPowerType(), Unit::GetShapeshiftForm(), MAX_POWERS, OFF_ATTACK, POWER_ENERGY, POWER_RAGE, ChrClassesEntry::powerType, RANGED_ATTACK, sChrClassesStore, Unit::SetAttackTime(), Unit::setPowerType(), SetRegularAttackTime(), sSpellShapeshiftFormStore, UpdateAttackPowerAndDamage(), and UpdateEquipSpellsAtFormChange().

Referenced by AuraEffect::HandleAuraModShapeshift(), and InitStatsForLevel().

◆ InitDisplayIds()

void Player::InitDisplayIds ( )
10598{
10599 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
10600 if (!info)
10601 {
10602 LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Can't init display ids.", GetGUID().ToString());
10603 return;
10604 }
10605
10606 uint8 gender = getGender();
10607 switch (gender)
10608 {
10609 case GENDER_FEMALE:
10612 break;
10613 case GENDER_MALE:
10616 break;
10617 default:
10618 LOG_ERROR("entities.player", "Invalid gender {} for player", gender);
10619 return;
10620 }
10621}
@ GENDER_MALE
Definition SharedDefines.h:61
@ GENDER_FEMALE
Definition SharedDefines.h:62
uint8 getGender() const
Definition Unit.h:798
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:16836
void SetNativeDisplayId(uint32 displayId)
Definition Unit.h:1891
uint16 displayId_m
Definition Player.h:351
uint16 displayId_f
Definition Player.h:352

References PlayerInfo::displayId_f, PlayerInfo::displayId_m, GENDER_FEMALE, GENDER_MALE, Unit::getClass(), Unit::getGender(), Object::GetGUID(), Unit::getRace(), LOG_ERROR, Unit::SetDisplayId(), Unit::SetNativeDisplayId(), sObjectMgr, and Position::ToString().

Referenced by Create(), modify_commandscript::HandleModifyGenderCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), and LoadFromDB().

◆ InitGlyphsForLevel()

void Player::InitGlyphsForLevel ( )
13253{
13254 for (uint32 i = 0; i < sGlyphSlotStore.GetNumRows(); ++i)
13255 if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(i))
13256 if (gs->Order)
13257 SetGlyphSlot(gs->Order - 1, gs->Id);
13258
13259 uint8 level = GetLevel();
13260 uint32 value = 0;
13261
13262 // 0x3F = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 for 80 level
13263 if (level >= 15)
13264 value |= (0x01 | 0x02);
13265 if (level >= 30)
13266 value |= 0x08;
13267 if (level >= 50)
13268 value |= 0x04;
13269 if (level >= 70)
13270 value |= 0x10;
13271 if (level >= 80)
13272 value |= 0x20;
13273
13275}
@ PLAYER_GLYPHS_ENABLED
Definition UpdateFields.h:390
void SetGlyphSlot(uint8 slot, uint32 slottype)
Definition Player.h:1770

References Unit::GetLevel(), PLAYER_GLYPHS_ENABLED, SetGlyphSlot(), Unit::SetUInt32Value(), and sGlyphSlotStore.

Referenced by Create(), GiveLevel(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ Initialize()

void Player::Initialize ( ObjectGuid::LowType  guid)
4788{
4790}

References Object::_Create(), and Player.

◆ InitPrimaryProfessions()

void Player::InitPrimaryProfessions ( )
11480{
11482}
@ CONFIG_MAX_PRIMARY_TRADE_SKILL
Definition WorldConfig.h:202

References CONFIG_MAX_PRIMARY_TRADE_SKILL, SetFreePrimaryProfessions(), and sWorld.

Referenced by Create(), and LoadFromDB().

◆ InitRunes()

void Player::InitRunes ( )
13423{
13425 return;
13426
13427 m_runes = new Runes;
13428
13429 m_runes->runeState = 0;
13431
13432 for (uint8 i = 0; i < MAX_RUNES; ++i)
13433 {
13434 SetBaseRune(i, runeSlotTypes[i]); // init base types
13435 SetCurrentRune(i, runeSlotTypes[i]); // init current types
13436 SetRuneCooldown(i, 0); // reset cooldowns
13437 SetGracePeriod(i, 0); // xinef: reset grace period
13438 SetRuneConvertAura(i, nullptr);
13440 }
13441
13442 for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
13444}
static RuneType runeSlotTypes[MAX_RUNES]
Definition Player.cpp:13412
@ NUM_RUNE_TYPES
Definition Player.h:419
@ RUNE_BLOOD
Definition Player.h:415
#define MAX_RUNES
Definition Player.h:404
@ PLAYER_RUNE_REGEN_1
Definition UpdateFields.h:386
void SetRuneCooldown(uint8 index, uint32 cooldown)
Definition Player.h:2533
void SetBaseRune(uint8 index, RuneType baseRune)
Definition Player.h:2531
void SetGracePeriod(uint8 index, uint32 period)
Definition Player.h:2534
Definition Player.h:432
void SetRuneState(uint8 index, bool set=true)
Definition Player.h:437

References CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, IsClass(), Runes::lastUsedRune, m_runes, MAX_RUNES, NUM_RUNE_TYPES, PLAYER_RUNE_REGEN_1, RUNE_BLOOD, runeSlotTypes, Runes::runeState, SetBaseRune(), SetCurrentRune(), Object::SetFloatValue(), SetGracePeriod(), SetRuneConvertAura(), SetRuneCooldown(), and Runes::SetRuneState().

Referenced by Create(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ InitStatsForLevel()

void Player::InitStatsForLevel ( bool  reapplyMods = false)
2589{
2590 if (reapplyMods) //reapply stats values only on .reset stats (level) command
2592
2593 PlayerClassLevelInfo classInfo;
2594 sObjectMgr->GetPlayerClassLevelInfo(getClass(), GetLevel(), &classInfo);
2595
2596 PlayerLevelInfo info;
2597 sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info);
2598
2599 uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
2600 sScriptMgr->OnPlayerSetMaxLevel(this, maxPlayerLevel);
2601 SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel);
2603
2604 // reset before any aura state sources (health set/aura apply)
2606
2608
2609 // set default cast time multiplier
2611
2612 // reset size before reapply auras
2613 SetObjectScale(1.0f);
2614
2615 // save base values (bonuses already included in stored stats
2616 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2617 SetCreateStat(Stats(i), info.stats[i]);
2618
2619 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2620 SetStat(Stats(i), info.stats[i]);
2621
2622 SetCreateHealth(classInfo.basehealth);
2623
2624 //set create powers
2625 SetCreateMana(classInfo.basemana);
2626
2628
2630
2631 //reset rating fields values
2633 SetUInt32Value(index, 0);
2634
2636 for (uint8 i = 0; i < 7; ++i)
2637 {
2641 }
2642
2643 //reset attack power, damage and attack speed fields
2645 SetFloatValue(UNIT_FIELD_BASEATTACKTIME + 1, 2000.0f); // offhand attack time
2647
2654
2661
2662 // Base crit values (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
2666
2667 // Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
2668 for (uint8 i = 0; i < 7; ++i)
2670
2674
2675 // Dodge percentage
2677
2678 // set armor (resistance 0) to original value (create_agility*2)
2680 SetResistanceBuffMods(SpellSchools(0), true, 0.0f);
2681 SetResistanceBuffMods(SpellSchools(0), false, 0.0f);
2682 // set other resistance to original value (0)
2683 for (uint8 i = 1; i < MAX_SPELL_SCHOOL; ++i)
2684 {
2686 SetResistanceBuffMods(SpellSchools(i), true, 0.0f);
2687 SetResistanceBuffMods(SpellSchools(i), false, 0.0f);
2688 }
2689
2692 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
2693 {
2696 }
2697 // Reset no reagent cost field
2698 for (uint8 i = 0; i < 3; ++i)
2700 // Init data for form but skip reapply item mods for form
2701 InitDataForForm(reapplyMods);
2702
2703 // save new stats
2704 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
2706
2707 SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later
2708
2709 // cleanup mounted state (it will set correctly at aura loading if player saved at mount.
2711
2712 // cleanup unit flags (will be re-applied if need at aura load).
2720 SetImmuneToAll(false);
2722
2724
2725 // cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
2727
2728 RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes
2730 {
2732 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
2733
2734 }
2735 // restore if need some important flags
2736 SetUInt32Value(PLAYER_FIELD_BYTES2, 0); // flags empty by default
2737
2738 if (reapplyMods) // reapply stats values only on .reset stats (level) command
2740
2741 // set current level health and mana/energy to maximum after applying all mods.
2742 SetFullHealth();
2750
2751 // update level to hunter/summon pet
2752 if (Pet* pet = GetPet())
2753 pet->SynchronizeLevelWithOwner();
2754}
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:503
@ PLAYER_FLAGS_DND
Definition Player.h:482
@ PLAYER_FLAGS_AFK
Definition Player.h:481
@ PLAYER_FLAGS_GM
Definition Player.h:483
@ UNIT_STAND_FLAGS_ALL
Definition UnitDefines.h:52
@ UNIT_BYTE2_FLAG_FFA_PVP
Definition UnitDefines.h:138
@ UNIT_BYTE2_FLAG_SANCTUARY
Definition UnitDefines.h:139
@ UNIT_FLAG_STUNNED
Definition UnitDefines.h:268
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:251
@ UNIT_FLAG_IN_COMBAT
Definition UnitDefines.h:269
@ UNIT_FLAG_DISARMED
Definition UnitDefines.h:271
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:267
@ UNIT_FLAG_CONFUSED
Definition UnitDefines.h:272
@ UNIT_FLAG_FLEEING
Definition UnitDefines.h:273
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:275
@ UNIT_FLAG_LOOTING
Definition UnitDefines.h:260
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition UnitDefines.h:257
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:263
@ UNIT_FLAG_MOUNT
Definition UnitDefines.h:277
@ UNIT_FLAG_PET_IN_COMBAT
Definition UnitDefines.h:261
@ UNIT_FIELD_MINDAMAGE
Definition UpdateFields.h:127
@ UNIT_FIELD_POWER_COST_MODIFIER
Definition UpdateFields.h:170
@ UNIT_FIELD_RANGEDATTACKTIME
Definition UpdateFields.h:121
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition UpdateFields.h:163
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition UpdateFields.h:353
@ PLAYER_SHIELD_BLOCK
Definition UpdateFields.h:355
@ UNIT_FIELD_MAXDAMAGE
Definition UpdateFields.h:128
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:167
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition UpdateFields.h:130
@ PLAYER_FIELD_BYTES2
Definition UpdateFields.h:378
@ UNIT_FIELD_AURASTATE
Definition UpdateFields.h:119
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition UpdateFields.h:169
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:164
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition UpdateFields.h:168
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition UpdateFields.h:166
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition UpdateFields.h:362
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition UpdateFields.h:171
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition UpdateFields.h:129
@ PLAYER_FIELD_MAX_LEVEL
Definition UpdateFields.h:384
@ UNIT_FIELD_BASEATTACKTIME
Definition UpdateFields.h:120
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
Definition UpdateFields.h:367
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:919
void _ApplyAllStatBonuses()
Definition StatSystem.cpp:1008
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:10550
void _RemoveAllStatBonuses()
Definition StatSystem.cpp:1020
uint32 GetCreatePowers(Powers power) const
Definition Unit.cpp:15738
void SetStat(Stats stat, int32 val)
Definition Unit.h:998
void SetResistanceBuffMods(SpellSchools school, bool positive, float val)
Definition Unit.h:1126
float m_createStats[MAX_STATS]
Definition Unit.h:2062
void SetResistance(SpellSchools school, int32 val)
Definition Unit.h:1125
void RemoveStandFlags(uint8 flags)
Definition Unit.h:1701
void SetArmor(int32 val)
Definition Unit.h:1082
void SetMaxHealth(uint32 val)
Definition Unit.cpp:15620
void InitStatBuffMods()
Definition Unit.h:1008
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition Unit.h:869

References _ApplyAllStatBonuses(), _RemoveAllStatBonuses(), PlayerClassLevelInfo::basehealth, PlayerClassLevelInfo::basemana, CONFIG_MAX_PLAYER_LEVEL, Unit::getClass(), Unit::GetCreatePowers(), Unit::GetLevel(), Unit::GetMaxPower(), GetPet(), Unit::GetPower(), Unit::getRace(), Object::HasByteFlag(), InitDataForForm(), Unit::InitStatBuffMods(), Unit::m_createStats, MAX_COMBAT_RATING, MAX_POWERS, MAX_SPELL_SCHOOL, MAX_STATS, PLAYER_ALLOW_ONLY_ABILITY, PLAYER_BLOCK_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_DODGE_PERCENTAGE, PLAYER_FIELD_BYTES2, PLAYER_FIELD_COMBAT_RATING_1, PLAYER_FIELD_MAX_LEVEL, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, PLAYER_FIELD_MOD_HEALING_DONE_POS, PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, PLAYER_FIELD_MOD_TARGET_RESISTANCE, PLAYER_FLAGS_AFK, PLAYER_FLAGS_DND, PLAYER_FLAGS_GHOST, PLAYER_FLAGS_GM, PLAYER_NEXT_LEVEL_XP, PLAYER_NO_REAGENT_COST_1, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_PARRY_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SHIELD_BLOCK, PLAYER_SPELL_CRIT_PERCENTAGE1, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Object::RemoveByteFlag(), Object::RemoveFlag(), RemovePlayerFlag(), Unit::RemoveStandFlags(), Unit::SetArmor(), Unit::SetCreateHealth(), Unit::SetCreateMana(), Unit::SetCreateStat(), Object::SetFloatValue(), Unit::SetFullHealth(), Unit::SetImmuneToAll(), Object::SetInt32Value(), Unit::SetMaxHealth(), Unit::SetMaxPower(), SetObjectScale(), Unit::SetPower(), Unit::SetResistance(), Unit::SetResistanceBuffMods(), Unit::SetStat(), Unit::SetUInt32Value(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), sObjectMgr, sScriptMgr, STAT_AGILITY, STAT_STRENGTH, PlayerLevelInfo::stats, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_FLAGS, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FIELD_POWER_COST_MODIFIER, UNIT_FIELD_POWER_COST_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FLAG2_REGENERATE_POWER, UNIT_FLAG_CONFUSED, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_DISARMED, UNIT_FLAG_FLEEING, UNIT_FLAG_IN_COMBAT, UNIT_FLAG_LOOTING, UNIT_FLAG_MOUNT, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PACIFIED, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_SILENCED, UNIT_FLAG_SKINNABLE, UNIT_FLAG_STUNNED, UNIT_FLAG_TAXI_FLIGHT, UNIT_MOD_CAST_SPEED, UNIT_STAND_FLAGS_ALL, and UpdateSkillsForLevel().

Referenced by Create(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ InitTalentForLevel()

void Player::InitTalentForLevel ( )
2574{
2575 uint32 talentPointsForLevel = CalculateTalentsPoints();
2576
2577 // xinef: more talent points that we have are used, reset
2578 if (m_usedTalentCount > talentPointsForLevel)
2579 resetTalents(true);
2580 // xinef: else, recalculate free talent points count
2581 else
2582 SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
2583
2584 if (!GetSession()->PlayerLoading())
2585 SendTalentsInfoData(false); // update at client
2586}
void SendTalentsInfoData(bool pet)
Definition Player.cpp:14390
bool resetTalents(bool noResetCost=false)
Definition Player.cpp:3729
void SetFreeTalentPoints(uint32 points)
Definition Player.cpp:3824
uint32 CalculateTalentsPoints() const
Definition Player.cpp:13585

References CalculateTalentsPoints(), GetSession(), m_usedTalentCount, resetTalents(), SendTalentsInfoData(), and SetFreeTalentPoints().

Referenced by ActivateSpec(), Create(), GiveLevel(), character_commandscript::HandleCharacterLevel(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), LoadFromDB(), and RewardQuest().

◆ InitTaxiNodesForLevel()

void Player::InitTaxiNodesForLevel ( )
inline

◆ inRandomLfgDungeon()

bool Player::inRandomLfgDungeon ( )
13040{
13041 if (sLFGMgr->selectedRandomLfgDungeon(GetGUID()))
13042 {
13043 Map const* map = GetMap();
13044 return sLFGMgr->inLfgDungeonMap(GetGUID(), map->GetId(), map->GetDifficulty());
13045 }
13046
13047 return false;
13048}

References Map::GetDifficulty(), Object::GetGUID(), Map::GetId(), WorldObject::GetMap(), and sLFGMgr.

◆ isAcceptWhispers()

bool Player::isAcceptWhispers ( ) const
inline

◆ IsActionButtonDataValid()

bool Player::IsActionButtonDataValid ( uint8  button,
uint32  action,
uint8  type 
)
5613{
5614 if (button >= MAX_ACTION_BUTTONS)
5615 {
5616 LOG_ERROR("entities.player", "Action {} not added into button {} for player {}: button must be < {}", action, button, GetName(), MAX_ACTION_BUTTONS);
5617 return false;
5618 }
5619
5620 if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
5621 {
5622 LOG_ERROR("entities.player", "Action {} not added into button {} for player {}: action must be < {}", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
5623 return false;
5624 }
5625
5626 switch (type)
5627 {
5629 if (!sSpellMgr->GetSpellInfo(action))
5630 {
5631 LOG_ERROR("entities.player", "Spell action {} not added into button {} for player {}: spell not exist", action, button, GetName());
5632 return false;
5633 }
5634
5635 if (!HasSpell(action))
5636 {
5637 LOG_DEBUG("entities.player.loading", "Player::IsActionButtonDataValid Spell action {} not added into button {} for player {}: player don't known this spell", action, button, GetName());
5638 return false;
5639 }
5640 break;
5641 case ACTION_BUTTON_ITEM:
5642 if (!sObjectMgr->GetItemTemplate(action))
5643 {
5644 LOG_ERROR("entities.player", "Item action {} not added into button {} for player {}: item not exist", action, button, GetName());
5645 return false;
5646 }
5647 break;
5648 default:
5649 break; // other cases not checked at this moment
5650 }
5651
5652 return true;
5653}
@ ACTION_BUTTON_ITEM
Definition Player.h:235
@ ACTION_BUTTON_SPELL
Definition Player.h:230
#define MAX_ACTION_BUTTONS
Definition Player.h:280
#define MAX_ACTION_BUTTON_ACTION_VALUE
Definition Player.h:256

References ACTION_BUTTON_ITEM, ACTION_BUTTON_SPELL, WorldObject::GetName(), HasSpell(), LOG_DEBUG, LOG_ERROR, MAX_ACTION_BUTTON_ACTION_VALUE, MAX_ACTION_BUTTONS, sObjectMgr, and sSpellMgr.

Referenced by addActionButton().

◆ IsActiveQuest()

bool Player::IsActiveQuest ( uint32  quest_id) const
203{
204 return m_QuestStatus.find(quest_id) != m_QuestStatus.end();
205}

References m_QuestStatus.

◆ IsAffectedBySpellmod()

bool Player::IsAffectedBySpellmod ( SpellInfo const *  spellInfo,
SpellModifier mod,
Spell spell = nullptr 
)
9756{
9757 if (!mod || !spellInfo)
9758 return false;
9759
9760 // Mod out of charges
9761 if (spell && mod->charges == -1 && spell->m_appliedMods.find(mod->ownerAura) == spell->m_appliedMods.end())
9762 return false;
9763
9764 // +duration to infinite duration spells making them limited
9765 if (mod->op == SPELLMOD_DURATION && spellInfo->GetDuration() == -1)
9766 return false;
9767
9768 return spellInfo->IsAffectedBySpellMod(mod);
9769}

References SpellModifier::charges, SpellInfo::GetDuration(), SpellInfo::IsAffectedBySpellMod(), Spell::m_appliedMods, SpellModifier::op, SpellModifier::ownerAura, and SPELLMOD_DURATION.

Referenced by ApplySpellMod().

◆ isAFK()

◆ isAllowedToLoot()

bool Player::isAllowedToLoot ( Creature const *  creature)
5628{
5629 if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward() || creature->IsLootRewardDisabled())
5630 return false;
5631
5632 if (HasPendingBind())
5633 return false;
5634
5635 const Loot* loot = &creature->loot;
5636 if (loot->isLooted()) // nothing to loot or everything looted.
5637 return false;
5638
5639 if (!loot->hasItemForAll() && !loot->hasItemFor(this)) // no loot in creature for this player
5640 return false;
5641
5642 if (loot->loot_type == LOOT_SKINNING)
5643 return creature->GetLootRecipientGUID() == GetGUID();
5644
5645 Group* thisGroup = GetGroup();
5646 if (!thisGroup)
5647 return this == creature->GetLootRecipient();
5648 else if (thisGroup != creature->GetLootRecipientGroup())
5649 return false;
5650
5651 switch (thisGroup->GetLootMethod())
5652 {
5653 case MASTER_LOOT:
5654 case FREE_FOR_ALL:
5655 return true;
5656 case ROUND_ROBIN:
5657 // may only loot if the player is the loot roundrobin player
5658 // or if there are free/quest/conditional item for the player
5659 if (!loot->roundRobinPlayer || loot->roundRobinPlayer == GetGUID())
5660 return true;
5661
5662 return loot->hasItemFor(this);
5663 case GROUP_LOOT:
5664 case NEED_BEFORE_GREED:
5665 // may only loot if the player is the loot roundrobin player
5666 // or item over threshold (so roll(s) can be launched)
5667 // or if there are free/quest/conditional item for the player
5668 if (!loot->roundRobinPlayer || loot->roundRobinPlayer == GetGUID())
5669 return true;
5670
5671 if (loot->hasOverThresholdItem())
5672 return true;
5673
5674 return loot->hasItemFor(this);
5675 }
5676
5677 return false;
5678}
@ NEED_BEFORE_GREED
Definition LootMgr.h:62
@ GROUP_LOOT
Definition LootMgr.h:61
@ MASTER_LOOT
Definition LootMgr.h:60
@ ROUND_ROBIN
Definition LootMgr.h:59
@ FREE_FOR_ALL
Definition LootMgr.h:58
@ LOOT_SKINNING
Definition LootMgr.h:85
LootMethod GetLootMethod() const
Definition Group.cpp:2315
bool HasPendingBind() const
Definition Player.h:2456
bool hasItemFor(Player *player) const
Definition LootMgr.cpp:937
bool isLooted() const
Definition LootMgr.h:368
bool hasOverThresholdItem() const
Definition LootMgr.cpp:982
ObjectGuid roundRobinPlayer
Definition LootMgr.h:324
bool hasItemForAll() const
Definition LootMgr.cpp:922
LootType loot_type
Definition LootMgr.h:326

References FREE_FOR_ALL, GetGroup(), Object::GetGUID(), Group::GetLootMethod(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), Creature::GetLootRecipientGUID(), GROUP_LOOT, Loot::hasItemFor(), Loot::hasItemForAll(), Loot::hasOverThresholdItem(), HasPendingBind(), Creature::IsDamageEnoughForLootingAndReward(), Unit::isDead(), Loot::isLooted(), Creature::IsLootRewardDisabled(), Creature::loot, LOOT_SKINNING, Loot::loot_type, MASTER_LOOT, NEED_BEFORE_GREED, ROUND_ROBIN, and Loot::roundRobinPlayer.

Referenced by Unit::PatchValuesUpdate().

◆ IsAlwaysDetectableFor()

bool Player::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

11435{
11437 return true;
11438
11439 if (duel && duel->State != DUEL_STATE_CHALLENGED && duel->Opponent == seer)
11440 {
11441 return false;
11442 }
11443
11444 if (Player const* seerPlayer = seer->ToPlayer())
11445 {
11446 if (IsGroupVisibleFor(seerPlayer))
11447 {
11448 return true;
11449 }
11450 }
11451
11452 return false;
11453}
@ DUEL_STATE_CHALLENGED
Definition Player.h:376
bool IsGroupVisibleFor(Player const *p) const
Definition Player.cpp:2309
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition Unit.cpp:14306

References duel, DUEL_STATE_CHALLENGED, Unit::IsAlwaysDetectableFor(), IsGroupVisibleFor(), and Object::ToPlayer().

◆ IsAtGroupRewardDistance()

bool Player::IsAtGroupRewardDistance ( WorldObject const *  pRewardSource) const
12729{
12730 WorldObject const* player = GetCorpse();
12731 if (!player || IsAlive())
12732 {
12733 player = this;
12734 }
12735
12736 if (!pRewardSource || !player->IsInMap(pRewardSource))
12737 {
12738 return false;
12739 }
12740
12741 if (pRewardSource->GetMap()->IsDungeon())
12742 {
12743 return true;
12744 }
12745
12746 return pRewardSource->GetDistance(player) <= sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE);
12747}
@ CONFIG_GROUP_XP_DISTANCE
Definition WorldConfig.h:144
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1213

References CONFIG_GROUP_XP_DISTANCE, GetCorpse(), WorldObject::GetDistance(), WorldObject::GetMap(), Unit::IsAlive(), Map::IsDungeon(), WorldObject::IsInMap(), and sWorld.

Referenced by KillRewarder::_InitGroupData(), KillRewarder::_RewardGroup(), SmartAI::EndPath(), GroupEventHappens(), OutdoorPvP::HandleKill(), OutdoorPvPNA::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), IsAtLootRewardDistance(), Group::NeedBeforeGreed(), RewardPlayerAndGroupAtEvent(), and npc_custodian_of_time::npc_custodian_of_timeAI::WaypointReached().

◆ IsAtLootRewardDistance()

bool Player::IsAtLootRewardDistance ( WorldObject const *  pRewardSource) const
12750{
12751 if (!IsAtGroupRewardDistance(pRewardSource))
12752 {
12753 return false;
12754 }
12755
12756 if (HasPendingBind())
12757 {
12758 return false;
12759 }
12760
12761 return pRewardSource->HasAllowedLooter(GetGUID());
12762}

References Object::GetGUID(), WorldObject::HasAllowedLooter(), HasPendingBind(), and IsAtGroupRewardDistance().

Referenced by Loot::FillLoot(), Group::GroupLoot(), WorldSession::HandleLootMoneyOpcode(), Group::MasterLoot(), and Group::UpdateLooterGuid().

◆ IsAtRecruitAFriendDistance()

bool Player::IsAtRecruitAFriendDistance ( WorldObject const *  pOther) const
12765{
12766 if (!pOther)
12767 return false;
12768 WorldObject const* player = GetCorpse();
12769 if (!player || IsAlive())
12770 player = this;
12771
12772 if (player->GetMapId() != pOther->GetMapId() || player->GetInstanceId() != pOther->GetInstanceId())
12773 return false;
12774
12775 return pOther->GetDistance(player) <= sWorld->getFloatConfig(CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE);
12776}
@ CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE
Definition WorldConfig.h:145

References CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE, GetCorpse(), WorldObject::GetDistance(), WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Unit::IsAlive(), and sWorld.

Referenced by GetsRecruitAFriendBonus().

◆ IsBagPos()

bool Player::IsBagPos ( uint16  pos)
static

◆ IsBankPos() [1/2]

◆ IsBankPos() [2/2]

bool Player::IsBankPos ( uint8  bag,
uint8  slot 
)
static
580{
581 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END))
582 return true;
583 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END))
584 return true;
585 if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)
586 return true;
587 return false;
588}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, and INVENTORY_SLOT_BAG_0.

◆ IsBaseRuneSlotsOnCooldown()

bool Player::IsBaseRuneSlotsOnCooldown ( RuneType  runeType) const
13447{
13448 for (uint8 i = 0; i < MAX_RUNES; ++i)
13449 if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0)
13450 return false;
13451
13452 return true;
13453}
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2525

References GetBaseRune(), GetRuneCooldown(), and MAX_RUNES.

Referenced by Unit::HandleProcTriggerSpell().

◆ isBeingLoaded()

bool Player::isBeingLoaded ( ) const
overridevirtual

◆ IsBeingTeleported()

◆ IsBeingTeleportedFar()

bool Player::IsBeingTeleportedFar ( ) const
inline

◆ IsBeingTeleportedNear()

bool Player::IsBeingTeleportedNear ( ) const
inline

◆ IsClass()

bool Player::IsClass ( Classes  playerClass,
ClassContext  context = CLASS_CONTEXT_NONE 
) const
overridevirtual

Reimplemented from Unit.

1296{
1297 Optional<bool> scriptResult = sScriptMgr->OnPlayerIsClass(this, unitClass, context);
1298 if (scriptResult != std::nullopt)
1299 return *scriptResult;
1300 else
1301 return (getClass() == unitClass);
1302}

References Unit::getClass(), and sScriptMgr.

Referenced by _ApplyItemBonuses(), ActivateSpec(), ActivateTaxiPathTo(), ApplyEnchantment(), CalculateTalentsPoints(), Group::CanJoinBattlegroundQueue(), CanResummonPet(), CanRollForItemInLFG(), CanUseItem(), Spell::CheckRuneCost(), Create(), WorldSession::DoLootRelease(), DuelComplete(), Spell::EffectActivateRune(), Spell::EffectSummonPet(), EquipItem(), spell_class_call_handler::FilterTargets(), FindEquipSlot(), Graveyard::GetClosestGraveyard(), GetNPCIfCanInteractWith(), spell_gen_on_tournament_mount::GetPennatSpellId(), GetStartPosition(), AuraEffect::HandleAuraConvertRune(), Aura::HandleAuraSpecificMods(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattlemasterJoinOpcode(), spell_item_refocus::HandleDummy(), WorldSession::HandleLootMoneyOpcode(), AuraEffect::HandlePeriodicDummyAuraTick(), Unit::HandleProcTriggerSpell(), reset_commandscript::HandleResetLevelCommand(), spell_gen_pet_summoned::HandleScript(), ArenaSpectator::HandleSpectatorSpectateCommand(), lfg::LFGMgr::InitializeLockedDungeons(), InitRunes(), Creature::isCanTrainingAndResetTalentsOf(), Pet::IsPermanentPetFor(), Creature::IsValidTrainerForPlayer(), LearnDefaultSkill(), Pet::LoadPetFromDB(), npc_bunthen_plainswind::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), PrepareGossipMenu(), RegenerateAll(), TeleportTo(), UpdateAttackPowerAndDamage(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ IsCommentator()

bool Player::IsCommentator ( ) const
inline
@ PLAYER_FLAGS_COMMENTATOR2
Definition Player.h:502

References HasPlayerFlag(), and PLAYER_FLAGS_COMMENTATOR2.

Referenced by GetChatTag(), and misc_commandscript::HandleCommentatorCommand().

◆ IsCurrentBattlegroundRandom()

bool Player::IsCurrentBattlegroundRandom ( ) const
inline
2276{ return m_bgData.bgIsRandom; }
bool bgIsRandom
Definition Player.h:1047

References BGData::bgIsRandom, and m_bgData.

◆ IsDailyQuestDone()

bool Player::IsDailyQuestDone ( uint32  quest_id)
12086{
12087 if (sObjectMgr->GetQuestTemplate(quest_id))
12088 {
12089 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12090 {
12091 if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx) == quest_id)
12092 {
12093 return true;
12094 }
12095 }
12096 }
12097
12098 return false;
12099}

References Object::GetUInt32Value(), PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and sObjectMgr.

◆ IsDeserter()

bool Player::IsDeserter ( ) const
inline
2282{ return HasAura(26013); }

References Unit::HasAura().

◆ IsDeveloper()

bool Player::IsDeveloper ( ) const
inline
@ PLAYER_FLAGS_DEVELOPER
Definition Player.h:495

References HasPlayerFlag(), and PLAYER_FLAGS_DEVELOPER.

Referenced by GetChatTag(), and misc_commandscript::HandleDevCommand().

◆ isDND()

◆ IsEquipmentPos() [1/2]

◆ IsEquipmentPos() [2/2]

bool Player::IsEquipmentPos ( uint8  bag,
uint8  slot 
)
static
571{
572 if (bag == INVENTORY_SLOT_BAG_0 && (slot < EQUIPMENT_SLOT_END))
573 return true;
575 return true;
576 return false;
577}

References EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, and INVENTORY_SLOT_BAG_START.

◆ IsExistPet()

bool Player::IsExistPet ( )

◆ IsFalling()

bool Player::IsFalling ( ) const
2171{
2172 // Xinef: Added !IsInFlight check
2173 return GetPositionZ() < m_lastFallZ && !IsInFlight();
2174}

References Position::GetPositionZ(), Unit::IsInFlight(), and m_lastFallZ.

Referenced by lfg::LFGMgr::TeleportPlayer().

◆ IsFFAPvP()

bool Player::IsFFAPvP ( )
16188{
16189 bool result = Unit::IsFFAPvP();
16190
16191 sScriptMgr->OnPlayerIsFFAPvP(this, result);
16192
16193 return result;
16194}
bool IsFFAPvP() const
Definition Unit.h:984

References Unit::IsFFAPvP(), and sScriptMgr.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), WorldSession::HandleRequestPartyMemberStatsOpcode(), RewardHonor(), UpdateFFAPvPFlag(), and UpdateFFAPvPState().

◆ IsGameMaster()

bool Player::IsGameMaster ( ) const
inline
1177{ return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
@ PLAYER_EXTRA_GM_ON
Definition Player.h:591

References m_ExtraFlags, and PLAYER_EXTRA_GM_ON.

Referenced by ThreatMgr::_addThreat(), Group::_homebindIfInstance(), Unit::_IsValidAssistTarget(), Unit::_IsValidAttackTarget(), Unit::Attack(), GameObject::BuildValuesUpdate(), BuyItemFromVendorSlot(), npc_coren_direbrew::CanBeSeen(), go_loosely_turned_soil::go_loosely_turned_soilAI::CanBeSeen(), Group::CanJoinBattlegroundQueue(), InstanceMap::CannotEnter(), CanTameExoticPets(), Spell::CheckCast(), CheckInstanceLoginValid(), SpellInfo::CheckTarget(), AchievementMgr::CompletedAchievement(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), spell_class_call_polymorph::FilterTargets(), GetPhaseMaskForSpawn(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleBattlemasterJoinOpcode(), HandleFall(), WorldSession::HandleGroupInviteOpcode(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandleInspectOpcode(), WorldSession::HandleMessagechatOpcode(), mmaps_commandscript::HandleMmapPathCommand(), misc_commandscript::HandlePInfoCommand(), Battlefield::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), tele_commandscript::HandleTeleCommand(), lfg::LFGMgr::InitializeLockedDungeons(), IsValidCombatTarget(), ThreatCalcHelper::isValidProcess(), boss_felblood_kaelthas::LapseAction(), WorldSession::LogoutPlayer(), MailSender::MailSender(), boss_nalorakk::MoveInLineOfSight(), npc_amanishi_lookout::MoveInLineOfSight(), npc_eagle_trash_aggro_trigger::MoveInLineOfSight(), npc_ouro_spawner::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_barnes::OnGossipHello(), go_ulduar_pure_saronite_deposit::OnGossipHello(), at_trigger_the_beast_movement::OnTrigger(), at_the_beast_room::OnTrigger(), at_ancient_leaf::OnTrigger(), at_lady_deathwhisper_entrance::OnTrigger(), at_icc_gauntlet_event::OnTrigger(), at_icc_putricide_trap::OnTrigger(), at_hor_shadow_throne::OnTrigger(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Unit::PatchValuesUpdate(), MapMgr::PlayerCannotEnter(), Unit::ProcessTerrainStatusUpdate(), Battleground::RemovePlayerAtLeave(), boss_kologarn_pit_kill_bunny::Reset(), AchievementMgr::ResetAchievementCriteria(), Satisfy(), npc_minigob_manabonk::SelectTargetInDalaran(), WorldSession::SendListInventory(), Spell::SendLoot(), SetIsSpectator(), Unit::TauntApply(), Unit::TauntFadeOut(), TeleportTo(), ToggleAFK(), AchievementMgr::UpdateAchievementCriteria(), boss_nefarian::UpdateAI(), UpdateFFAPvPState(), UpdateHomebindTime(), and Whisper().

◆ isGMChat()

bool Player::isGMChat ( ) const
inline
@ PLAYER_EXTRA_GM_CHAT
Definition Player.h:595

References m_ExtraFlags, and PLAYER_EXTRA_GM_CHAT.

Referenced by GetChatTag().

◆ IsGMSpectator()

bool Player::IsGMSpectator ( ) const
inline
@ PLAYER_EXTRA_GM_SPECTATOR
Definition Player.h:600

References m_ExtraFlags, and PLAYER_EXTRA_GM_SPECTATOR.

Referenced by gm_commandscript::HandleGMSpectatorCommand(), and Unit::PatchValuesUpdate().

◆ isGMVisible()

bool Player::isGMVisible ( ) const
inline
@ PLAYER_EXTRA_GM_INVISIBLE
Definition Player.h:594

References m_ExtraFlags, and PLAYER_EXTRA_GM_INVISIBLE.

Referenced by gm_commandscript::HandleGMVisibleCommand(), and Channel::Invite().

◆ IsGroupVisibleFor()

bool Player::IsGroupVisibleFor ( Player const *  p) const
2310{
2311 switch (sWorld->getIntConfig(CONFIG_GROUP_VISIBILITY))
2312 {
2313 default:
2314 return IsInSameGroupWith(p);
2315 case 1:
2316 return IsInSameRaidWith(p);
2317 case 2:
2318 return GetTeamId() == p->GetTeamId();
2319 }
2320}
@ CONFIG_GROUP_VISIBILITY
Definition WorldConfig.h:211
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1899
bool IsInSameGroupWith(Player const *p) const
Definition Player.cpp:2322

References CONFIG_GROUP_VISIBILITY, GetTeamId(), IsInSameGroupWith(), IsInSameRaidWith(), and sWorld.

Referenced by IsAlwaysDetectableFor().

◆ isHonorOrXPTarget()

bool Player::isHonorOrXPTarget ( Unit victim) const
12639{
12640 uint8 v_level = victim->GetLevel();
12642
12643 // Victim level less gray level
12644 if (v_level <= k_grey)
12645 return false;
12646
12647 if (victim->IsCreature())
12648 if (victim->IsTotem() || victim->IsCritter() || victim->IsPet() || victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_XP))
12649 return false;
12650
12651 return true;
12652}
@ CREATURE_FLAG_EXTRA_NO_XP
Definition CreatureData.h:51
bool HasFlagsExtra(uint32 flag) const
Definition Creature.h:73
bool IsCritter() const
Definition Unit.h:783
bool IsTotem() const
Definition Unit.h:749

References CREATURE_FLAG_EXTRA_NO_XP, Acore::XP::GetGrayLevel(), Unit::GetLevel(), Creature::HasFlagsExtra(), Object::IsCreature(), Unit::IsCritter(), Unit::IsPet(), Unit::IsTotem(), and Object::ToCreature().

Referenced by spell_warl_drain_soul::HandleTick(), Unit::IsTriggeredAtSpellProcEvent(), achievement_killed_exp_or_honor_target::OnCheck(), RaiseDeadCheck::operator()(), spell_warl_drain_soul::RemoveEffect(), and spell_warl_shadowburn::RemoveEffect().

◆ IsImmuneToEnvironmentalDamage()

bool Player::IsImmuneToEnvironmentalDamage ( )
759{
760 // check for GM and death state included in isAttackableByAOE
761 return (!isTargetableForAttack(false, nullptr)) || isTotalImmune();
762}
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition Unit.cpp:13946

References Unit::isTargetableForAttack(), and isTotalImmune().

Referenced by EnvironmentalDamage().

◆ IsInAreaTriggerRadius()

bool Player::IsInAreaTriggerRadius ( AreaTrigger const *  trigger,
float  delta = 0.f 
) const
2198{
2199 if (!trigger || GetMapId() != trigger->map)
2200 return false;
2201
2202 if (trigger->radius > 0)
2203 {
2204 // if we have radius check it
2205 float dist = GetDistance(trigger->x, trigger->y, trigger->z);
2206 if (dist > trigger->radius + delta)
2207 return false;
2208 }
2209 else
2210 {
2211 Position center(trigger->x, trigger->y, trigger->z, trigger->orientation);
2212 if (!IsWithinBox(center, trigger->length / 2 + delta, trigger->width / 2 + delta, trigger->height / 2 + delta))
2213 return false;
2214 }
2215
2216 return true;
2217}
Definition Position.h:27
bool IsWithinBox(const Position &center, float xradius, float yradius, float zradius) const
Definition Position.cpp:111

References WorldObject::GetDistance(), WorldLocation::GetMapId(), AreaTrigger::height, Position::IsWithinBox(), AreaTrigger::length, AreaTrigger::map, AreaTrigger::orientation, AreaTrigger::radius, AreaTrigger::width, AreaTrigger::x, AreaTrigger::y, and AreaTrigger::z.

Referenced by WorldSession::HandleAreaTriggerOpcode(), and Update().

◆ IsInSameGroupWith()

bool Player::IsInSameGroupWith ( Player const *  p) const
2323{
2324 return p == this || (GetGroup() &&
2325 GetGroup() == p->GetGroup() &&
2326 GetGroup()->SameSubGroup(this, p));
2327}
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition Group.cpp:2362

References GetGroup(), and Group::SameSubGroup().

Referenced by IsGroupVisibleFor(), and Unit::IsInPartyWith().

◆ IsInSameRaidWith()

◆ IsInventoryPos() [1/2]

◆ IsInventoryPos() [2/2]

bool Player::IsInventoryPos ( uint8  bag,
uint8  slot 
)
static
558{
559 if (bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT)
560 return true;
562 return true;
564 return true;
565 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END))
566 return true;
567 return false;
568}

References CURRENCYTOKEN_SLOT_END, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_START, and NULL_SLOT.

◆ IsInvitedForBattlegroundInstance() [1/2]

bool Player::IsInvitedForBattlegroundInstance ( ) const
inline
2275{ return m_bgData.isInvited; }
bool isInvited
Definition Player.h:1046

References BGData::isInvited, and m_bgData.

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::LogoutPlayer().

◆ IsInvitedForBattlegroundInstance() [2/2]

bool Player::IsInvitedForBattlegroundInstance ( uint32  instanceId) const
12258{
12259 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12260 if (_BgBattlegroundQueueID[i].invitedToInstance == instanceId)
12261 return true;
12262
12263 return false;
12264}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

◆ IsInvitedForBattlegroundQueueType()

bool Player::IsInvitedForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId) const
12200{
12201 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12202 if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
12203 return _BgBattlegroundQueueID[i].invitedToInstance != 0;
12204
12205 return false;
12206}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by WorldSession::HandleBattleFieldPortOpcode().

◆ IsInWater()

bool Player::IsInWater ( ) const
inlineoverridevirtual

Reimplemented from Unit.

1138{ return m_isInWater; }

References m_isInWater.

Referenced by WorldSession::HandleMovementOpcodes().

◆ IsInWhisperWhiteList()

bool Player::IsInWhisperWhiteList ( ObjectGuid  guid)
15858{
15859 for (auto const& itr : WhisperList)
15860 {
15861 if (itr == guid)
15862 {
15863 return true;
15864 }
15865 }
15866
15867 return false;
15868}

References WhisperList.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ IsMaxLevel()

bool Player::IsMaxLevel ( ) const

◆ IsMirrorTimerActive()

bool Player::IsMirrorTimerActive ( MirrorTimerType  type)
inline
2078{ return m_MirrorTimer[type] == getMaxTimer(type); }

References getMaxTimer(), and m_MirrorTimer.

Referenced by lfg::LFGMgr::TeleportPlayer().

◆ IsNeedCastPassiveSpellAtLearn()

bool Player::IsNeedCastPassiveSpellAtLearn ( SpellInfo const *  spellInfo) const
3308{
3309 // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
3310 // talent dependent passives activated at form apply have proper stance data
3312 return (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) ||
3313 (!form && spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED)));
3314}
@ SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED
Definition SharedDefines.h:475

References Unit::GetShapeshiftForm(), SpellInfo::HasAttribute(), SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED, and SpellInfo::Stances.

Referenced by _addSpell(), and _addTalentAurasAndSpells().

◆ IsNeverVisible()

bool Player::IsNeverVisible ( ) const
overridevirtual

Reimplemented from WorldObject.

11411{
11413 return true;
11414
11415 if (GetSession()->PlayerLogout() || GetSession()->PlayerLoading())
11416 return true;
11417
11418 return false;
11419}
virtual bool IsNeverVisible() const
Definition Object.h:743

References GetSession(), and WorldObject::IsNeverVisible().

◆ IsOutdoorPvPActive()

bool Player::IsOutdoorPvPActive ( )

◆ IsPetNeedBeTemporaryUnsummoned()

bool Player::IsPetNeedBeTemporaryUnsummoned ( ) const
inline
2434{ return GetSession()->PlayerLogout() || !IsInWorld() || !IsAlive() || IsMounted()/*+in flight*/ || GetVehicle() || IsBeingTeleported(); }
Vehicle * GetVehicle() const
Definition Unit.h:1839
bool PlayerLogout() const
Definition WorldSession.h:343

References GetSession(), Unit::GetVehicle(), Unit::IsAlive(), IsBeingTeleported(), Object::IsInWorld(), Unit::IsMounted(), and WorldSession::PlayerLogout().

Referenced by Pet::LoadPetFromDB(), and ResummonPetTemporaryUnSummonedIfAny().

◆ IsPvP()

bool Player::IsPvP ( )
16197{
16198 bool result = Unit::IsPvP();
16199
16200 sScriptMgr->OnPlayerIsPvP(this, result);
16201
16202 return result;
16203}
bool IsPvP() const
Definition Unit.h:983

References Unit::IsPvP(), and sScriptMgr.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), DuelComplete(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleRequestPartyMemberStatsOpcode(), IsOutdoorPvPActive(), UpdatePvPFlag(), and UpdatePvPState().

◆ IsQuestRewarded()

bool Player::IsQuestRewarded ( uint32  quest_id) const
inline

◆ isResurrectRequested()

bool Player::isResurrectRequested ( ) const
inline

◆ isResurrectRequestedBy()

bool Player::isResurrectRequestedBy ( ObjectGuid  guid) const
inline
1840{ return m_resurrectGUID && m_resurrectGUID == guid; }

References m_resurrectGUID.

◆ IsSpectator()

◆ IsSpellFitByClassAndRace()

bool Player::IsSpellFitByClassAndRace ( uint32  spell_id) const
12327{
12328 uint32 racemask = getRaceMask();
12329 uint32 classmask = getClassMask();
12330
12331 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
12332 if (bounds.first == bounds.second)
12333 return true;
12334
12335 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
12336 {
12337 // skip wrong race skills
12338 if (_spell_idx->second->RaceMask && (_spell_idx->second->RaceMask & racemask) == 0)
12339 continue;
12340
12341 // skip wrong class skills
12342 if (_spell_idx->second->ClassMask && (_spell_idx->second->ClassMask & classmask) == 0)
12343 continue;
12344
12345 return true;
12346 }
12347
12348 return false;
12349}

References Unit::getClassMask(), Unit::getRaceMask(), and sSpellMgr.

Referenced by GetTrainerSpellState(), learn_commandscript::HandleLearnAllMySpellsCommand(), and WorldSession::SendTrainerList().

◆ IsSummonAsSpectator()

bool Player::IsSummonAsSpectator ( ) const

◆ isTaxiCheater()

bool Player::isTaxiCheater ( ) const
inline

◆ isTotalImmune()

bool Player::isTotalImmune ( ) const
13278{
13280
13281 uint32 immuneMask = 0;
13282 for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
13283 {
13284 immuneMask |= (*itr)->GetMiscValue();
13285 if (immuneMask & SPELL_SCHOOL_MASK_ALL) // total immunity
13286 return true;
13287 }
13288 return false;
13289}
@ SPELL_SCHOOL_MASK_ALL
Definition SharedDefines.h:315
@ SPELL_AURA_SCHOOL_IMMUNITY
Definition SpellAuraDefines.h:102

References Unit::GetAuraEffectsByType(), SPELL_AURA_SCHOOL_IMMUNITY, and SPELL_SCHOOL_MASK_ALL.

Referenced by CanUseBattlegroundObject(), and IsImmuneToEnvironmentalDamage().

◆ IsTotemCategoryCompatiableWith()

bool Player::IsTotemCategoryCompatiableWith ( ItemTemplate const *  pProto,
uint32  requiredTotemCategoryId 
) const
882{
883 if (requiredTotemCategoryId == 0)
884 return true;
885 if (pProto->TotemCategory == 0)
886 return false;
887
888 TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(pProto->TotemCategory);
889 if (!itemEntry)
890 return false;
891 TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
892 if (!reqEntry)
893 return false;
894
895 if (itemEntry->categoryType != reqEntry->categoryType)
896 return false;
897
898 if ((itemEntry->categoryMask & reqEntry->categoryMask) != reqEntry->categoryMask)
899 return false;
900
901 // xinef: check skill requirements, needed for enchants!
902 if (pProto->RequiredSkill)
903 if (this->GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank)
904 return false;
905
906 return true;
907}
DBCStorage< TotemCategoryEntry > sTotemCategoryStore(TotemCategoryEntryfmt)
Definition DBCStructure.h:1995
uint32 categoryType
Definition DBCStructure.h:1999
uint32 categoryMask
Definition DBCStructure.h:2000

References TotemCategoryEntry::categoryMask, TotemCategoryEntry::categoryType, GetSkillValue(), ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, sTotemCategoryStore, and ItemTemplate::TotemCategory.

Referenced by HasItemTotemCategory().

◆ IsTwoHandUsed()

◆ IsUsingLfg()

bool Player::IsUsingLfg ( )

◆ IsValidGender()

static bool Player::IsValidGender ( uint8  Gender)
inlinestatic
1586{ return Gender <= GENDER_FEMALE; }
Gender
Definition SharedDefines.h:60

References GENDER_FEMALE.

Referenced by BuildEnumData(), Create(), ConditionMgr::isConditionTypeValid(), and LoadFromDB().

◆ IsValidPos() [1/2]

bool Player::IsValidPos ( uint16  pos,
bool  explicit_pos 
)
inline
1285{ return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
bool IsValidPos(uint16 pos, bool explicit_pos)
Definition Player.h:1285

References IsValidPos().

Referenced by WorldSession::HandleAutoStoreBagItemOpcode(), item_commandscript::HandleItemMoveCommand(), WorldSession::HandleSplitItemOpcode(), WorldSession::HandleSwapInvItemOpcode(), WorldSession::HandleSwapItem(), and IsValidPos().

◆ IsValidPos() [2/2]

bool Player::IsValidPos ( uint8  bag,
uint8  slot,
bool  explicit_pos 
)
602{
603 // post selected
604 if (bag == NULL_BAG && !explicit_pos)
605 return true;
606
607 if (bag == INVENTORY_SLOT_BAG_0)
608 {
609 // any post selected
610 if (slot == NULL_SLOT && !explicit_pos)
611 return true;
612
613 // equipment
614 if (slot < EQUIPMENT_SLOT_END)
615 return true;
616
617 // bag equip slots
619 return true;
620
621 // backpack slots
623 return true;
624
625 // keyring slots
626 if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END)
627 return true;
628
629 // bank main slots
630 if (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END)
631 return true;
632
633 // bank bag slots
634 if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
635 return true;
636
637 return false;
638 }
639
640 // bag content slots
641 // bank bag content slots
642 if (Bag* pBag = GetBagByPos(bag))
643 {
644 // any post selected
645 if (slot == NULL_SLOT && !explicit_pos)
646 return true;
647
648 return slot < pBag->GetBagSize();
649 }
650
651 // where this?
652 return false;
653}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, EQUIPMENT_SLOT_END, GetBagByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_END, KEYRING_SLOT_START, NULL_BAG, and NULL_SLOT.

◆ IsVisibleGloballyFor()

bool Player::IsVisibleGloballyFor ( Player const *  player) const
11456{
11457 if (!u)
11458 return false;
11459
11460 // Always can see self
11461 if (u == this)
11462 return true;
11463
11464 // Visible units, always are visible for all players
11465 if (IsVisible())
11466 return true;
11467
11468 // GMs are visible for higher gms (or players are visible for gms)
11469 if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity()))
11470 return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity();
11471
11472 if (!sScriptMgr->OnPlayerNotVisibleGloballyFor(const_cast<Player*>(this), u))
11473 return true;
11474
11475 // non faction visibility non-breakable for non-GMs
11476 return false;
11477}
bool IsVisible() const
Definition Unit.h:1926
AccountTypes GetSecurity() const
Definition WorldSession.h:378

References WorldSession::GetSecurity(), GetSession(), AccountMgr::IsPlayerAccount(), Unit::IsVisible(), and sScriptMgr.

Referenced by SocialMgr::BroadcastToFriendListers(), SocialMgr::GetFriendInfo(), WorldSession::HandleAddFriendOpcode(), and ChatHandler::needReportToTarget().

◆ ItemAddedQuestCheck()

void Player::ItemAddedQuestCheck ( uint32  entry,
uint32  count 
)
1836{
1837 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1838 {
1839 uint32 questid = GetQuestSlotQuestId(i);
1840 if (questid == 0)
1841 continue;
1842
1843 QuestStatusData& q_status = m_QuestStatus[questid];
1844
1845 if (q_status.Status != QUEST_STATUS_INCOMPLETE)
1846 continue;
1847
1848 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1849 if (!qInfo || !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
1850 continue;
1851
1852 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
1853 {
1854 uint32 reqitem = qInfo->RequiredItemId[j];
1855 if (reqitem == entry)
1856 {
1857 uint32 reqitemcount = qInfo->RequiredItemCount[j];
1858 uint16 curitemcount = q_status.ItemCount[j];
1859 if (curitemcount < reqitemcount)
1860 {
1861 q_status.ItemCount[j] = std::min<uint16>(q_status.ItemCount[j] + count, reqitemcount);
1862 m_QuestStatusSave[questid] = true;
1863 }
1864 if (CanCompleteQuest(questid))
1865 CompleteQuest(questid);
1866 else
1868 }
1869 }
1870 }
1872}

References ADDITIONAL_SAVING_INVENTORY_AND_GOLD, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, QuestStatusData::Status, and UpdateForQuestWorldObjects().

Referenced by Spell::EffectSummonChangeItem(), EquipNewItem(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), MoveItemToInventory(), StoreNewItem(), and SwapItem().

◆ ItemRemovedQuestCheck()

void Player::ItemRemovedQuestCheck ( uint32  entry,
uint32  count 
)
1875{
1876 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1877 {
1878 uint32 questid = GetQuestSlotQuestId(i);
1879 if (!questid)
1880 continue;
1881
1882 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1883 if (!qInfo)
1884 continue;
1885
1887 continue;
1888
1889 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
1890 {
1891 uint32 reqitem = qInfo->RequiredItemId[j];
1892 if (reqitem == entry)
1893 {
1894 QuestStatusData& q_status = m_QuestStatus[questid];
1895 uint32 reqitemcount = qInfo->RequiredItemCount[j];
1896 uint16 curitemcount = q_status.ItemCount[j];
1897
1898 if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows
1899 curitemcount = GetItemCount(entry, false);
1900
1901 uint16 newItemCount = (count > curitemcount) ? 0 : curitemcount - count;
1902 newItemCount = std::min<uint16>(newItemCount, reqitemcount);
1903 if (newItemCount != q_status.ItemCount[j])
1904 {
1905 q_status.ItemCount[j] = newItemCount;
1906 m_QuestStatusSave[questid] = true;
1907 IncompleteQuest(questid);
1908 }
1909 }
1910 }
1911 }
1913}
void IncompleteQuest(uint32 quest_id)
Definition PlayerQuest.cpp:642

References GetItemCount(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), IncompleteQuest(), QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, and UpdateForQuestWorldObjects().

Referenced by DestroyItem(), DestroyItemCount(), DestroyItemCount(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleSellItemOpcode(), MoveItemFromInventory(), and SwapItem().

◆ JoinedChannel()

void Player::JoinedChannel ( Channel c)
5026{
5027 m_channels.push_back(c);
5028}

References m_channels.

Referenced by Channel::JoinChannel().

◆ KillCreditGO()

void Player::KillCreditGO ( uint32  entry,
ObjectGuid  guid = ObjectGuid::Empty 
)
2057{
2058 uint16 addCastCount = 1;
2059 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2060 {
2061 uint32 questid = GetQuestSlotQuestId(i);
2062 if (!questid)
2063 continue;
2064
2065 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
2066 if (!qInfo)
2067 continue;
2068
2069 QuestStatusData& q_status = m_QuestStatus[questid];
2070
2071 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2072 {
2073 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL)*/)
2074 {
2075 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
2076 {
2077 uint32 reqTarget = 0;
2078
2079 // GO activate objective
2080 if (qInfo->RequiredNpcOrGo[j] < 0)
2081 // checked at quest_template loading
2082 reqTarget = - qInfo->RequiredNpcOrGo[j];
2083
2084 // other not this creature/GO related objectives
2085 if (reqTarget != entry)
2086 continue;
2087
2088 uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j];
2089 uint16 curCastCount = q_status.CreatureOrGOCount[j];
2090 if (curCastCount < reqCastCount)
2091 {
2092 q_status.CreatureOrGOCount[j] = curCastCount + addCastCount;
2093
2094 m_QuestStatusSave[questid] = true;
2095
2096 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curCastCount, addCastCount);
2097 }
2098
2099 if (CanCompleteQuest(questid))
2100 CompleteQuest(questid);
2101 else
2103
2104 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
2105 break;
2106 }
2107 }
2108 }
2109 }
2110}
void SendQuestUpdateAddCreatureOrGo(Quest const *quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
Definition PlayerQuest.cpp:2456

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, GetQuestSlotQuestId(), Quest::HasSpecialFlag(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, and QuestStatusData::Status.

Referenced by GameObject::Use().

◆ KilledMonster()

void Player::KilledMonster ( CreatureTemplate const *  cInfo,
ObjectGuid  guid 
)
1916{
1917 ASSERT(cInfo);
1918
1919 if (cInfo->Entry)
1920 KilledMonsterCredit(cInfo->Entry, guid);
1921
1922 for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
1923 if (cInfo->KillCredit[i])
1924 KilledMonsterCredit(cInfo->KillCredit[i]);
1925}
#define MAX_KILL_CREDIT
Definition CreatureData.h:30
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:1927

References ASSERT, CreatureTemplate::Entry, CreatureTemplate::KillCredit, KilledMonsterCredit(), and MAX_KILL_CREDIT.

Referenced by KillRewarder::_RewardKillCredit(), and npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit().

◆ KilledMonsterCredit()

void Player::KilledMonsterCredit ( uint32  entry,
ObjectGuid  guid = ObjectGuid::Empty 
)
1928{
1929 uint16 addkillcount = 1;
1930 uint32 real_entry = entry;
1931 if (guid)
1932 {
1933 Creature* killed = GetMap()->GetCreature(guid);
1934 if (killed && killed->GetEntry())
1935 real_entry = killed->GetEntry();
1936 }
1937
1938 StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST
1939 UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : nullptr);
1940
1941 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1942 {
1943 uint32 questid = GetQuestSlotQuestId(i);
1944 if (!questid)
1945 continue;
1946
1947 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1948 if (!qInfo)
1949 continue;
1950 // just if !ingroup || !noraidgroup || raidgroup
1951 // xinef: or is pvp quest, and player in BG/BF group
1952 QuestStatusData& q_status = m_QuestStatus[questid];
1953 if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()) ||
1954 (qInfo->IsPVPQuest() && (GetGroup()->isBFGroup() || GetGroup()->isBGGroup()))))
1955 {
1956 if (!sScriptMgr->OnPlayerPassedQuestKilledMonsterCredit(this, qInfo, entry, real_entry, guid))
1957 continue;
1958
1959 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST)*/)
1960 {
1961 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
1962 {
1963 // skip GO activate objective or none
1964 if (qInfo->RequiredNpcOrGo[j] <= 0)
1965 continue;
1966
1967 uint32 reqkill = qInfo->RequiredNpcOrGo[j];
1968
1969 if (reqkill == real_entry)
1970 {
1971 uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j];
1972 uint16 curkillcount = q_status.CreatureOrGOCount[j];
1973 if (curkillcount < reqkillcount)
1974 {
1975 q_status.CreatureOrGOCount[j] = curkillcount + addkillcount;
1976
1977 m_QuestStatusSave[questid] = true;
1978
1979 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curkillcount, addkillcount);
1980 }
1981 if (CanCompleteQuest(questid))
1982 CompleteQuest(questid);
1983 else
1985
1986 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
1987 break;
1988 }
1989 }
1990 }
1991 }
1992 }
1993}
@ ACHIEVEMENT_TIMED_TYPE_CREATURE
Definition DBCEnums.h:114
@ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE
Definition DBCEnums.h:122
Creature * GetCreature(ObjectGuid const guid)
Definition Map.cpp:2282
bool IsPVPQuest() const
Definition QuestDef.h:295
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:210

References ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_TIMED_TYPE_CREATURE, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, Map::GetCreature(), GetDifficulty(), Object::GetEntry(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), Quest::IsAllowedInRaid(), Quest::IsPVPQuest(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_KILL, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, sScriptMgr, StartTimedAchievement(), QuestStatusData::Status, and UpdateAchievementCriteria().

Referenced by npc_dragonmaw_peon::npc_dragonmaw_peonAI::CreditPlayer(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundAB::EventPlayerClickedOnFlag(), go_tadpole_cage::go_tadpole_cageAI::GossipHello(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), spell_q10714_on_spirits_wings::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), spell_q12937_relief_for_the_fallen::HandleDummy(), spell_q12659_ahunaes_knife::HandleDummy(), spell_q9874_liquid_fire::HandleDummy(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), OutdoorPvPNA::HandleKillImpl(), BattlegroundAV::HandleKillUnit(), spell_q12805_lifeblood_dummy::HandleScript(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_q11065_wrangle_some_aether_rays_aura::if(), spell_gen_have_item_auras::if(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), KilledMonster(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), go_scourge_enclosure::OnGossipHello(), go_warmaul_prison::OnGossipHello(), go_scourge_cage::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), go_veil_skith_cage::OnGossipHello(), npc_captain_saeed::OnGossipSelect(), RewardPlayerAndGroupAtEvent(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), npc_hallows_end_train_fire::SpellHit(), npc_jungle_punch_target::npc_jungle_punch_targetAI::SpellHit(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ KilledPlayerCredit()

void Player::KilledPlayerCredit ( uint16  count = 1)
1996{
1997 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1998 {
1999 uint32 questid = GetQuestSlotQuestId(i);
2000 if (!questid)
2001 {
2002 continue;
2003 }
2004
2005 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
2006 if (!qInfo)
2007 {
2008 continue;
2009 }
2010
2011 // just if !ingroup || !noraidgroup || raidgroup
2012 QuestStatusData& q_status = m_QuestStatus[questid];
2013 if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty())))
2014 {
2015 // Xinef: PvP Killing quest require player to be in same zone as quest zone (only 2 quests so no doubt, can be extended to conditions in cata ;s)
2016 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL) && (qInfo->GetZoneOrSort() >= 0 && GetZoneId() == uint32(qInfo->GetZoneOrSort())))
2017 {
2018 KilledPlayerCreditForQuest(count, qInfo);
2019 break; // there is only one quest per zone
2020 }
2021 }
2022 }
2023}
void KilledPlayerCreditForQuest(uint16 count, Quest const *quest)
Definition PlayerQuest.cpp:2025
int32 GetZoneOrSort() const
Definition QuestDef.h:230

References GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), WorldObject::GetZoneId(), Quest::GetZoneOrSort(), Quest::HasSpecialFlag(), Quest::IsAllowedInRaid(), KilledPlayerCreditForQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by KillRewarder::_RewardPlayer().

◆ KilledPlayerCreditForQuest()

void Player::KilledPlayerCreditForQuest ( uint16  count,
Quest const *  quest 
)
2026{
2027 uint32 const questId = quest->GetQuestId();
2028
2029 auto it = m_QuestStatus.find(questId);
2030 if (it == m_QuestStatus.end())
2031 {
2032 return;
2033 }
2034
2035 QuestStatusData& questStatus = it->second;
2036
2037 uint16 curKill = questStatus.PlayerCount;
2038 uint32 reqKill = quest->GetPlayersSlain();
2039
2040 if (curKill < reqKill)
2041 {
2042 count = std::min<uint16>(reqKill - curKill, count);
2043 questStatus.PlayerCount = curKill + count;
2044
2045 m_QuestStatusSave[quest->GetQuestId()] = true;
2046
2047 SendQuestUpdateAddPlayer(quest, curKill, count);
2048 }
2049
2050 if (CanCompleteQuest(questId))
2051 {
2052 CompleteQuest(questId);
2053 }
2054}
void SendQuestUpdateAddPlayer(Quest const *quest, uint16 old_count, uint16 add_count)
Definition PlayerQuest.cpp:2479

References CanCompleteQuest(), CompleteQuest(), Quest::GetPlayersSlain(), Quest::GetQuestId(), m_QuestStatus, m_QuestStatusSave, QuestStatusData::PlayerCount, and SendQuestUpdateAddPlayer().

Referenced by KilledPlayerCredit().

◆ KillPlayer()

void Player::KillPlayer ( )
4585{
4586 if (IsFlying() && !GetTransport())
4588
4590
4591 StopMirrorTimers(); //disable timers(bars)
4592
4594 //SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
4595
4598
4599 // 6 minutes until repop at graveyard
4601
4602 UpdateCorpseReclaimDelay(); // dependent at use SetDeathPvP() call before kill
4603
4604 int32 corpseReclaimDelay = CalculateCorpseReclaimDelay();
4605
4606 if (corpseReclaimDelay >= 0)
4607 SendCorpseReclaimDelay(corpseReclaimDelay);
4608
4609 sScriptMgr->OnPlayerJustDied(this);
4610 // don't create corpse at this moment, player might be falling
4611
4612 // update visibility
4613 //UpdateObjectVisibility(); // pussywizard: not needed
4614}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition Player.h:566
@ MOVE_ROOT
Definition Player.h:462
@ UNIT_DYNFLAG_NONE
Definition SharedDefines.h:3359
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:627
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:888
void UpdateCorpseReclaimDelay()
Definition PlayerUpdates.cpp:1931
void setDeathState(DeathState s, bool despawn=false) override
Definition Player.cpp:1024
void ReplaceAllDynamicFlags(uint32 flag) override
Definition Unit.h:724
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
bool HasPreventResurectionAura() const
Definition Unit.h:1721
bool IsFlying() const
Definition Unit.h:1627

References Object::ApplyModFlag(), CalculateCorpseReclaimDelay(), Corpse, WorldLocation::GetMapId(), Unit::GetMotionMaster(), WorldObject::GetTransport(), Unit::HasPreventResurectionAura(), IN_MILLISECONDS, Unit::IsFlying(), m_deathTimer, MINUTE, MOVE_ROOT, MotionMaster::MoveFall(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, Unit::ReplaceAllDynamicFlags(), SendCorpseReclaimDelay(), setDeathState(), SetMovement(), sMapStore, sScriptMgr, StopMirrorTimers(), UNIT_DYNFLAG_NONE, and UpdateCorpseReclaimDelay().

Referenced by WorldSession::HandleMovementOpcodes(), WorldSession::HandleRepopRequestOpcode(), WorldSession::LogoutPlayer(), and Update().

◆ LearnCustomSpells()

void Player::LearnCustomSpells ( )
11807{
11808 if (!sWorld->getBoolConfig(CONFIG_START_CUSTOM_SPELLS))
11809 {
11810 return;
11811 }
11812
11813 // learn default race/class spells
11814 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
11815 ASSERT(info);
11816 for (PlayerCreateInfoSpells::const_iterator itr = info->customSpells.begin(); itr != info->customSpells.end(); ++itr)
11817 {
11818 uint32 tspell = *itr;
11819 LOG_DEBUG("entities.player.loading", "Player::LearnCustomSpells: Player '{}' ({}, Class: {} Race: {}): Adding initial spell (SpellID: {})",
11820 GetName(), GetGUID().ToString(), uint32(getClass()), uint32(getRace()), tspell);
11821 if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
11822 {
11823 addSpell(tspell, SPEC_MASK_ALL, true);
11824 }
11825 else // but send in normal spell in game learn case
11826 {
11827 learnSpell(tspell);
11828 }
11829 }
11830}
@ CONFIG_START_CUSTOM_SPELLS
Definition WorldConfig.h:83
PlayerCreateInfoSpells customSpells
Definition Player.h:354

References addSpell(), ASSERT, CONFIG_START_CUSTOM_SPELLS, PlayerInfo::customSpells, Unit::getClass(), Object::GetGUID(), WorldObject::GetName(), Unit::getRace(), Object::IsInWorld(), learnSpell(), LOG_DEBUG, sObjectMgr, SPEC_MASK_ALL, sWorld, and Position::ToString().

Referenced by Create(), learn_commandscript::HandleLearnAllDefaultCommand(), LoadFromDB(), and resetSpells().

◆ LearnDefaultSkill()

void Player::LearnDefaultSkill ( uint32  skillId,
uint16  rank 
)
11847{
11848 SkillRaceClassInfoEntry const* rcInfo = GetSkillRaceClassInfo(skillId, getRace(), getClass());
11849 if (!rcInfo)
11850 return;
11851
11852 LOG_DEBUG("entities.player.loading", "PLAYER (Class: {} Race: {}): Adding initial skill, id = {}", uint32(getClass()), uint32(getRace()), skillId);
11853 switch (GetSkillRangeType(rcInfo))
11854 {
11856 SetSkill(skillId, 0, 300, 300);
11857 break;
11858 case SKILL_RANGE_LEVEL:
11859 {
11860 uint16 skillValue = 1;
11861 uint16 maxValue = GetMaxSkillValueForLevel();
11862 if (sWorld->getBoolConfig(CONFIG_ALWAYS_MAXSKILL) && !IsProfessionOrRidingSkill(skillId))
11863 {
11864 skillValue = maxValue;
11865 }
11866 else if (rcInfo->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
11867 {
11868 skillValue = maxValue;
11869 }
11871 {
11872 skillValue = std::min(std::max<uint16>({ 1, uint16((GetLevel() - 1) * 5) }), maxValue);
11873 }
11874 else if (skillId == SKILL_FIST_WEAPONS)
11875 {
11876 skillValue = std::max<uint16>(1, GetSkillValue(SKILL_UNARMED));
11877 }
11878 else if (skillId == SKILL_LOCKPICKING)
11879 {
11880 skillValue = std::max<uint16>(1, GetSkillValue(SKILL_LOCKPICKING));
11881 }
11882
11883 SetSkill(skillId, 0, skillValue, maxValue);
11884 break;
11885 }
11886 case SKILL_RANGE_MONO:
11887 SetSkill(skillId, 0, 1, 1);
11888 break;
11889 case SKILL_RANGE_RANK:
11890 {
11891 if (!rank)
11892 {
11893 break;
11894 }
11895
11896 SkillTiersEntry const* tier = sSkillTiersStore.LookupEntry(rcInfo->SkillTierID);
11897 uint16 maxValue = tier->Value[std::max<int32>(rank - 1, 0)];
11898 uint16 skillValue = 1;
11899 if (rcInfo->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
11900 {
11901 skillValue = maxValue;
11902 }
11904 {
11905 skillValue = std::min(std::max<uint16>({ uint16(1), uint16((GetLevel() - 1) * 5) }), maxValue);
11906 }
11907
11908 SetSkill(skillId, rank, skillValue, maxValue);
11909 break;
11910 }
11911 default:
11912 break;
11913 }
11914}
@ SKILL_FLAG_ALWAYS_MAX_VALUE
Definition DBCEnums.h:386
@ SKILL_RANGE_RANK
Definition ObjectMgr.h:676
bool IsProfessionOrRidingSkill(uint32 skill)
Definition SpellMgr.h:623
@ CLASS_CONTEXT_SKILL
Definition UnitDefines.h:232
uint32 SkillTierID
Definition DBCStructure.h:1577
uint32 Flags
Definition DBCStructure.h:1575
uint32 Value[MAX_SKILL_STEP]
Definition DBCStructure.h:1619

References CLASS_CONTEXT_SKILL, CLASS_DEATH_KNIGHT, CONFIG_ALWAYS_MAXSKILL, SkillRaceClassInfoEntry::Flags, Unit::getClass(), Unit::GetLevel(), GetMaxSkillValueForLevel(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), GetSkillValue(), IsClass(), IsProfessionOrRidingSkill(), LOG_DEBUG, SetSkill(), SKILL_FIST_WEAPONS, SKILL_FLAG_ALWAYS_MAX_VALUE, SKILL_LOCKPICKING, SKILL_RANGE_LANGUAGE, SKILL_RANGE_LEVEL, SKILL_RANGE_MONO, SKILL_RANGE_RANK, SKILL_UNARMED, SkillRaceClassInfoEntry::SkillTierID, sSkillTiersStore, sWorld, and SkillTiersEntry::Value.

Referenced by _addSpell(), and LearnDefaultSkills().

◆ LearnDefaultSkills()

void Player::LearnDefaultSkills ( )
11833{
11834 // learn default race/class skills
11835 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
11836 for (PlayerCreateInfoSkills::const_iterator itr = info->skills.begin(); itr != info->skills.end(); ++itr)
11837 {
11838 uint32 skillId = itr->SkillId;
11839 if (HasSkill(skillId))
11840 continue;
11841
11842 LearnDefaultSkill(skillId, itr->Rank);
11843 }
11844}
PlayerCreateInfoSkills skills
Definition Player.h:357

References Unit::getClass(), Unit::getRace(), HasSkill(), LearnDefaultSkill(), PlayerInfo::skills, and sObjectMgr.

Referenced by Create(), learn_commandscript::HandleLearnAllDefaultCommand(), LoadFromDB(), and resetSpells().

◆ LearnPetTalent()

void Player::LearnPetTalent ( ObjectGuid  petGuid,
uint32  talentId,
uint32  talentRank 
)
14046{
14047 Pet* pet = GetPet();
14048
14049 if (!pet)
14050 return;
14051
14052 if (petGuid != pet->GetGUID())
14053 return;
14054
14055 uint32 CurTalentPoints = pet->GetFreeTalentPoints();
14056
14057 if (CurTalentPoints == 0)
14058 return;
14059
14060 if (talentRank >= MAX_PET_TALENT_RANK)
14061 return;
14062
14063 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
14064
14065 if (!talentInfo)
14066 return;
14067
14068 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
14069
14070 if (!talentTabInfo)
14071 return;
14072
14073 CreatureTemplate const* ci = pet->GetCreatureTemplate();
14074
14075 if (!ci)
14076 return;
14077
14078 CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
14079
14080 if (!pet_family)
14081 return;
14082
14083 if (pet_family->petTalentType < 0) // not hunter pet
14084 return;
14085
14086 // prevent learn talent for different family (cheating)
14087 if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
14088 return;
14089
14090 // find current max talent rank (0~5)
14091 uint8 curtalent_maxrank = 0; // 0 = not learned any rank
14092 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
14093 {
14094 if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
14095 {
14096 curtalent_maxrank = (rank + 1);
14097 break;
14098 }
14099 }
14100
14101 // we already have same or higher talent rank learned
14102 if (curtalent_maxrank >= (talentRank + 1))
14103 return;
14104
14105 // check if we have enough talent points
14106 if (CurTalentPoints < (talentRank - curtalent_maxrank + 1))
14107 return;
14108
14109 // Check if it requires another talent
14110 if (talentInfo->DependsOn > 0)
14111 {
14112 if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
14113 {
14114 bool hasEnoughRank = false;
14115 for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
14116 {
14117 if (depTalentInfo->RankID[rank] != 0)
14118 if (pet->HasSpell(depTalentInfo->RankID[rank]))
14119 hasEnoughRank = true;
14120 }
14121 if (!hasEnoughRank)
14122 return;
14123 }
14124 }
14125
14126 // Find out how many points we have in this field
14127 uint32 spentPoints = 0;
14128
14129 uint32 tTab = talentInfo->TalentTab;
14130 if (talentInfo->Row > 0)
14131 {
14132 uint32 numRows = sTalentStore.GetNumRows();
14133 for (uint32 i = 0; i < numRows; ++i) // Loop through all talents.
14134 {
14135 // Someday, someone needs to revamp
14136 const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i);
14137 if (tmpTalent) // the way talents are tracked
14138 {
14139 if (tmpTalent->TalentTab == tTab)
14140 {
14141 for (uint8 rank = 0; rank < MAX_TALENT_RANK; rank++)
14142 {
14143 if (tmpTalent->RankID[rank] != 0)
14144 {
14145 if (pet->HasSpell(tmpTalent->RankID[rank]))
14146 {
14147 spentPoints += (rank + 1);
14148 }
14149 }
14150 }
14151 }
14152 }
14153 }
14154 }
14155
14156 // not have required min points spent in talent tree
14157 if (spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
14158 return;
14159
14160 // spell not set in talent.dbc
14161 uint32 spellid = talentInfo->RankID[talentRank];
14162 if (spellid == 0)
14163 {
14164 LOG_ERROR("entities.player", "Talent.dbc have for talent: {} Rank: {} spell id = 0", talentId, talentRank);
14165 return;
14166 }
14167
14168 // already known
14169 if (pet->HasSpell(spellid))
14170 return;
14171
14172 // learn! (other talent ranks will unlearned at learning)
14173 pet->learnSpell(spellid);
14174 LOG_DEBUG("entities.player", "PetTalentID: {} Rank: {} Spell: {}\n", talentId, talentRank, spellid);
14175
14176 // update free talent points
14177 pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
14178}
#define MAX_PET_TALENT_RANK
Definition DBCStructure.h:1920
void SetFreeTalentPoints(uint8 points)
Definition Pet.h:132
bool learnSpell(uint32 spell_id)
Definition Pet.cpp:1915
uint32 Row
Definition DBCStructure.h:1927
uint32 DependsOnRank
Definition DBCStructure.h:1933
uint32 DependsOn
Definition DBCStructure.h:1931

References TalentEntry::DependsOn, TalentEntry::DependsOnRank, CreatureTemplate::family, Creature::GetCreatureTemplate(), Pet::GetFreeTalentPoints(), Object::GetGUID(), GetPet(), Pet::HasSpell(), Pet::learnSpell(), LOG_DEBUG, LOG_ERROR, MAX_PET_TALENT_RANK, MAX_TALENT_RANK, TalentTabEntry::petTalentMask, CreatureFamilyEntry::petTalentType, TalentEntry::RankID, TalentEntry::Row, sCreatureFamilyStore, Pet::SetFreeTalentPoints(), sTalentStore, sTalentTabStore, and TalentEntry::TalentTab.

Referenced by WorldSession::HandleLearnPreviewTalentsPet(), and WorldSession::HandlePetLearnTalent().

◆ learnQuestRewardedSpells() [1/2]

void Player::learnQuestRewardedSpells ( )
11949{
11950 // learn spells received from quest completing
11951 for (RewardedQuestSet::const_iterator itr = m_RewardedQuests.begin(); itr != m_RewardedQuests.end(); ++itr)
11952 {
11953 Quest const* quest = sObjectMgr->GetQuestTemplate(*itr);
11954 if (!quest)
11955 continue;
11956
11958 }
11959}

References learnQuestRewardedSpells(), m_RewardedQuests, and sObjectMgr.

Referenced by _LoadQuestStatusRewarded(), learn_commandscript::HandleLearnAllDefaultCommand(), learnQuestRewardedSpells(), and resetSpells().

◆ learnQuestRewardedSpells() [2/2]

void Player::learnQuestRewardedSpells ( Quest const *  quest)
11917{
11918 // xinef: quest does not learn anything
11919 int32 spellId = quest->GetRewSpellCast();
11920 if (!spellId)
11921 return;
11922
11923 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
11924 if (!spellInfo)
11925 return;
11926
11927 // xinef: find effect with learn spell and check if we have this spell
11928 bool found = false;
11929 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
11930 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && spellInfo->Effects[i].TriggerSpell && !HasSpell(spellInfo->Effects[i].TriggerSpell))
11931 {
11932 // pusywizard: don't re-add profession specialties!
11933 if (SpellInfo const* triggeredInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell))
11934 if (triggeredInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL)
11935 break; // pussywizard: break and not cast the spell (found is false)
11936
11937 found = true;
11938 break;
11939 }
11940
11941 // xinef: we know the spell, return
11942 if (!found)
11943 return;
11944
11945 CastSpell(this, spellId, true);
11946}
@ SPELL_EFFECT_TRADE_SKILL
Definition SharedDefines.h:825

References Unit::CastSpell(), SpellInfo::Effects, Quest::GetRewSpellCast(), HasSpell(), MAX_SPELL_EFFECTS, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_TRADE_SKILL, and sSpellMgr.

◆ learnSkillRewardedSpells()

void Player::learnSkillRewardedSpells ( uint32  id,
uint32  value 
)
11962{
11963 uint32 raceMask = getRaceMask();
11964 uint32 classMask = getClassMask();
11965 for (SkillLineAbilityEntry const* pAbility : GetSkillLineAbilitiesBySkillLine(skill_id))
11966 {
11967 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pAbility->Spell);
11968 if (!spellInfo)
11969 {
11970 continue;
11971 }
11972
11973 if (pAbility->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE && pAbility->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN)
11974 {
11975 continue;
11976 }
11977
11978 // Check race if set
11979 if (pAbility->RaceMask && !(pAbility->RaceMask & raceMask))
11980 {
11981 continue;
11982 }
11983
11984 // Check class if set
11985 if (pAbility->ClassMask && !(pAbility->ClassMask & classMask))
11986 {
11987 continue;
11988 }
11989
11990 // need unlearn spell
11991 if (skill_value < pAbility->MinSkillLineRank && pAbility->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE)
11992 {
11993 removeSpell(pAbility->Spell, GetActiveSpec(), true);
11994 }
11995 // need learn
11996 else
11997 {
11998 //used to avoid double Seal of Righteousness on paladins, it's the only player spell which has both spell and forward spell in auto learn
11999 if (pAbility->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && pAbility->SupercededBySpell)
12000 {
12001 bool skipCurrent = false;
12002 auto bounds = sSpellMgr->GetSkillLineAbilityMapBounds(pAbility->SupercededBySpell);
12003 for (auto itr = bounds.first; itr != bounds.second; ++itr)
12004 {
12005 if (itr->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && skill_value >= itr->second->MinSkillLineRank)
12006 {
12007 skipCurrent = true;
12008 break;
12009 }
12010 }
12011 if (skipCurrent)
12012 {
12013 continue;
12014 }
12015 }
12016
12017 if (!IsInWorld())
12018 {
12019 addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true);
12020 }
12021 else
12022 {
12023 learnSpell(pAbility->Spell, true, true);
12024 }
12025 }
12026 }
12027}
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE
Definition DBCEnums.h:360
const std::vector< SkillLineAbilityEntry const * > & GetSkillLineAbilitiesBySkillLine(uint32 skillLine)
Definition DBCStores.cpp:916
Definition DBCStructure.h:1599

References addSpell(), GetActiveSpec(), Unit::getClassMask(), Unit::getRaceMask(), GetSkillLineAbilitiesBySkillLine(), Object::IsInWorld(), learnSpell(), removeSpell(), SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN, SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE, SPEC_MASK_ALL, and sSpellMgr.

Referenced by _LoadSkills(), SetSkill(), and UpdateSkillPro().

◆ learnSpell()

void Player::learnSpell ( uint32  spellId,
bool  temporary = false,
bool  learnFromSkill = false 
)
3317{
3318 // Xinef: don't allow to learn active spell once more
3319 if (HasActiveSpell(spellId))
3320 {
3321 LOG_DEBUG("entities.player", "Player ({}) tries to learn already active spell: {}", GetGUID().ToString(), spellId);
3322 return;
3323 }
3324
3325 uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId);
3326 bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId);
3327 bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true, temporary, learnFromSkill);
3328 if (added)
3329 {
3330 sScriptMgr->OnPlayerLearnSpell(this, spellId);
3331
3332 // pussywizard: a system message "you have learnt spell X (rank Y)"
3333 if (IsInWorld())
3334 SendLearnPacket(spellId, true);
3335 }
3336
3337 // pussywizard: rank stuff at the end!
3338 if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spellId))
3339 {
3340 // pussywizard: lookup next rank in m_spells (the only talents on m_spella are for example pyroblast, that have all ranks restored upon learning rank 1)
3341 // pussywizard: next ranks must not be in current spec (otherwise no need to learn already learnt)
3342 PlayerSpellMap::iterator itr = m_spells.find(nextSpell);
3343 if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && !itr->second->IsInSpec(m_activeSpec))
3344 learnSpell(nextSpell, temporary);
3345 }
3346
3347 // xinef: if we learn new spell, check all spells requiring this spell, if we have such a spell, and it is not in current spec - learn it
3348 SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spellId);
3349 for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr)
3350 {
3351 PlayerSpellMap::iterator itr2 = m_spells.find(itr->second);
3352 if (itr2 != m_spells.end() && itr2->second->State != PLAYERSPELL_REMOVED && !itr2->second->IsInSpec(m_activeSpec))
3353 learnSpell(itr2->first, temporary);
3354 }
3355}
uint32 GetTalentSpellCost(uint32 spellId)
Definition DBCStores.cpp:686

References addSpell(), GetActiveSpecMask(), Object::GetGUID(), GetTalentSpellCost(), HasActiveSpell(), Object::IsInWorld(), learnSpell(), LOG_DEBUG, m_activeSpec, m_spells, PLAYERSPELL_REMOVED, SendLearnPacket(), SPEC_MASK_ALL, sScriptMgr, sSpellMgr, and Position::ToString().

Referenced by _addSpell(), Spell::EffectLearnSpell(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllMySpellsCommand(), learn_commandscript::HandleLearnSkillRecipesHelper(), Acore::PlayerCommand::HandleLearnSpellCommand(), spell_gen_profession_research::HandleScript(), spell_item_book_of_glyph_mastery::HandleScript(), WorldSession::HandleTrainerBuySpellOpcode(), LearnCustomSpells(), learnSkillRewardedSpells(), learnSpell(), learnSpellHighRank(), LearnTalent(), and UpdateCraftSkill().

◆ learnSpellHighRank()

void Player::learnSpellHighRank ( uint32  spellid)
13631{
13632 learnSpell(spellid);
13633
13634 if (uint32 next = sSpellMgr->GetNextSpellInChain(spellid))
13635 learnSpellHighRank(next);
13636}
void learnSpellHighRank(uint32 spellid)
Definition Player.cpp:13630

References learnSpell(), learnSpellHighRank(), and sSpellMgr.

Referenced by learnSpellHighRank().

◆ LearnTalent()

void Player::LearnTalent ( uint32  talentId,
uint32  talentRank,
bool  command = false 
)
13913{
13914 uint32 CurTalentPoints = GetFreeTalentPoints();
13915
13916 if (!command)
13917 {
13918 // xinef: check basic data
13919 if (!CurTalentPoints)
13920 {
13921 return;
13922 }
13923
13924 if (talentRank >= MAX_TALENT_RANK)
13925 {
13926 return;
13927 }
13928 }
13929
13930 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
13931 if (!talentInfo)
13932 return;
13933
13934 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
13935 if (!talentTabInfo)
13936 return;
13937
13938 // xinef: prevent learn talent for different class (cheating)
13939 if ((getClassMask() & talentTabInfo->ClassMask) == 0)
13940 return;
13941
13942 // xinef: find current talent rank
13943 uint32 currentTalentRank = 0;
13944 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
13945 {
13946 if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], GetActiveSpec()))
13947 {
13948 currentTalentRank = rank + 1;
13949 break;
13950 }
13951 }
13952
13953 // xinef: we already have same or higher rank talent learned
13954 if (currentTalentRank >= talentRank + 1)
13955 return;
13956
13957 uint32 talentPointsChange = (talentRank - currentTalentRank + 1);
13958 if (!command)
13959 {
13960 // xinef: check if we have enough free talent points
13961 if (CurTalentPoints < talentPointsChange)
13962 {
13963 return;
13964 }
13965 }
13966
13967 // xinef: check if talent deponds on another talent
13968 if (talentInfo->DependsOn > 0)
13969 if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
13970 {
13971 bool hasEnoughRank = false;
13972 for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
13973 {
13974 if (depTalentInfo->RankID[rank] != 0)
13975 if (HasTalent(depTalentInfo->RankID[rank], GetActiveSpec()))
13976 {
13977 hasEnoughRank = true;
13978 break;
13979 }
13980 }
13981
13982 // xinef: does not have enough talent points spend in required talent
13983 if (!hasEnoughRank)
13984 return;
13985 }
13986
13987 if (!command)
13988 {
13989 // xinef: check amount of points spent in current talent tree
13990 // xinef: be smart and quick
13991 uint32 spentPoints = 0;
13992 if (talentInfo->Row > 0)
13993 {
13994 const PlayerTalentMap& talentMap = GetTalentMap();
13995 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
13996 if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first))
13997 if (TalentEntry const* itrTalentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
13998 if (itrTalentInfo->TalentTab == talentInfo->TalentTab)
13999 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) // pussywizard
14000 spentPoints += talentPos->rank + 1;
14001 }
14002
14003 // xinef: we do not have enough talent points to add talent of this tier
14004 if (spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
14005 return;
14006 }
14007
14008 // xinef: hacking attempt, tries to learn unknown rank
14009 uint32 spellId = talentInfo->RankID[talentRank];
14010 if (spellId == 0)
14011 return;
14012
14013 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
14014 if (!spellInfo)
14015 return;
14016
14017 bool learned = false;
14018
14019 // xinef: if talent info has special marker in dbc - add to spell book
14020 if (talentInfo->addToSpellBook)
14021 if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
14022 {
14023 learnSpell(spellId);
14024 learned = true;
14025 }
14026
14027 if (!learned)
14028 SendLearnPacket(spellId, true);
14029
14030 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
14031 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
14032 if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
14033 learnSpell(spellInfo->Effects[i].TriggerSpell);
14034
14035 addTalent(spellId, GetActiveSpecMask(), currentTalentRank);
14036
14037 if (!command)
14038 {
14039 SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
14040 }
14041
14042 sScriptMgr->OnPlayerLearnTalents(this, talentId, talentRank, spellId);
14043}
uint32 ClassMask
Definition DBCStructure.h:1947

References addTalent(), TalentEntry::addToSpellBook, TalentTabEntry::ClassMask, TalentEntry::DependsOn, TalentEntry::DependsOnRank, SpellInfo::Effects, GetActiveSpec(), GetActiveSpecMask(), Unit::getClassMask(), GetFreeTalentPoints(), GetTalentMap(), GetTalentSpellPos(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), HasTalent(), learnSpell(), MAX_SPELL_EFFECTS, MAX_TALENT_RANK, PLAYERSPELL_REMOVED, TalentEntry::RankID, TalentEntry::Row, SendLearnPacket(), SetFreeTalentPoints(), SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, sTalentStore, sTalentTabStore, and TalentEntry::TalentTab.

Referenced by learn_commandscript::HandleLearnAllMyTalentsCommand(), WorldSession::HandleLearnPreviewTalents(), and WorldSession::HandleLearnTalentOpcode().

◆ LeaveAllArenaTeams()

void Player::LeaveAllArenaTeams ( ObjectGuid  guid)
static
10166{
10167 // xinef: sync query
10169 stmt->SetData(0, guid.GetCounter());
10170 PreparedQueryResult result = CharacterDatabase.Query(stmt);
10171
10172 if (!result)
10173 return;
10174
10175 do
10176 {
10177 Field* fields = result->Fetch();
10178 uint32 arenaTeamId = fields[0].Get<uint32>();
10179 if (arenaTeamId != 0)
10180 {
10181 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
10182 if (arenaTeam)
10183 arenaTeam->DelMember(guid, true);
10184 }
10185 } while (result->NextRow());
10186}
@ CHAR_SEL_PLAYER_ARENA_TEAMS
Definition CharacterDatabase.h:233
void DelMember(ObjectGuid guid, bool cleanDb)
Definition ArenaTeam.cpp:327

References CHAR_SEL_PLAYER_ARENA_TEAMS, CharacterDatabase, ArenaTeam::DelMember(), Field::Get(), ObjectGuid::GetCounter(), sArenaTeamMgr, and PreparedStatementBase::SetData().

Referenced by DeleteFromDB(), and WorldSession::HandleCharFactionOrRaceChangeCallback().

◆ LeaveBattleground()

void Player::LeaveBattleground ( Battleground bg = nullptr)
11300{
11301 if (!bg)
11302 bg = GetBattleground();
11303
11304 if (!bg)
11305 return;
11306
11307 // Deserter tracker - leave BG
11308 if (bg->isBattleground() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
11309 {
11310 if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
11311 {
11313 stmt->SetData(0, GetGUID().GetCounter());
11315 CharacterDatabase.Execute(stmt);
11316 }
11317 sScriptMgr->OnPlayerBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
11318 }
11319
11320 if (bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
11321 sScriptMgr->OnPlayerBattlegroundDesertion(this, ARENA_DESERTION_TYPE_LEAVE_BG);
11322
11323 // xinef: reset corpse reclaim time
11325
11326 // Remove all dots
11330
11331 // pussywizard: clear movement, because after porting player will move to arena cords
11333 StopMoving();
11335}
@ BG_DESERTION_TYPE_LEAVE_BG
Definition Battleground.h:52
@ ARENA_DESERTION_TYPE_LEAVE_BG
Definition Battleground.h:57
@ STATUS_WAIT_JOIN
Definition Battleground.h:192
@ CHAR_INS_DESERTER_TRACK
Definition CharacterDatabase.h:501
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition SpellAuraDefines.h:152
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116
@ CONFIG_BATTLEGROUND_TRACK_DESERTERS
Definition WorldConfig.h:75
bool isBattleground() const
Definition Battleground.h:405
BattlegroundStatus GetStatus() const
Definition Battleground.h:323
void MovementExpired(bool reset=true)
Definition MotionMaster.h:180
bool TeleportToEntryPoint()
Definition Player.cpp:1612
void StopMoving()
Definition Unit.cpp:16724

References ARENA_DESERTION_TYPE_LEAVE_BG, BG_DESERTION_TYPE_LEAVE_BG, CHAR_INS_DESERTER_TRACK, CharacterDatabase, CONFIG_BATTLEGROUND_TRACK_DESERTERS, GetBattleground(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetMotionMaster(), Battleground::GetStatus(), Battleground::isArena(), Battleground::isBattleground(), m_deathExpireTime, MotionMaster::MovementExpired(), Unit::RemoveAurasByType(), PreparedStatementBase::SetData(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_LEECH, sScriptMgr, STATUS_IN_PROGRESS, STATUS_WAIT_JOIN, Unit::StopMoving(), sWorld, and TeleportToEntryPoint().

Referenced by BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::LogoutPlayer(), and ToggleAFK().

◆ LeftChannel()

void Player::LeftChannel ( Channel c)
5031{
5032 m_channels.remove(c);
5033}

References m_channels.

Referenced by Channel::KickOrBan(), Channel::LeaveChannel(), and UpdateLocalChannels().

◆ LoadActions()

void Player::LoadActions ( PreparedQueryResult  result)
15242{
15243 if (result)
15244 _LoadActions(result);
15245
15247}
void _LoadActions(PreparedQueryResult result)
Definition PlayerStorage.cpp:5680

References _LoadActions(), and SendActionButtons().

◆ LoadCorpse()

void Player::LoadCorpse ( PreparedQueryResult  result)
5823{
5825 SpawnCorpseBones(false);
5826
5827 if (!IsAlive())
5828 {
5829 if (result && !HasAtLoginFlag(AT_LOGIN_RESURRECT))
5830 {
5831 Field* fields = result->Fetch();
5832 _corpseLocation.WorldRelocate(fields[0].Get<uint16>(), fields[1].Get<float>(), fields[2].Get<float>(), fields[3].Get<float>(), fields[4].Get<float>());
5834 }
5835 else
5836 ResurrectPlayer(0.5f);
5837 }
5838
5840}
void RemoveAtLoginFlag(AtLoginFlags flags, bool persist=false)
Definition Player.cpp:14605
bool HasAtLoginFlag(AtLoginFlags f) const
Definition Player.h:2419
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4504

References _corpseLocation, Object::ApplyModFlag(), AT_LOGIN_RESURRECT, WorldLocation::GetMapId(), HasAtLoginFlag(), Unit::IsAlive(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, RemoveAtLoginFlag(), ResurrectPlayer(), sMapStore, SpawnCorpseBones(), and WorldLocation::WorldRelocate().

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadFromDB()

bool Player::LoadFromDB ( ObjectGuid  guid,
CharacterDatabaseQueryHolder const &  holder 
)
4926{
4928 //QueryResult* result = CharacterDatabase.Query("SELECT guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, playerFlags, "
4929 // 17 18 19 20 21 22 23 24 25 26 27 28 29
4930 //"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
4931 // 30 31 32 33 34 35 36 37 38 39 40 41 42 43
4932 //"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
4933 // 44 45 46 47 48 49 50 51 52 53 54
4934 //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
4935 // 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
4936 //"health, power1, power2, power3, power4, power5, power6, power7, instance_id, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, ammoId, knownTitles,
4937 // 70 71 72 73 74
4938 //"actionBars, grantableLevels, innTriggerId, extraBonusTalentCount, UNIX_TIMESTAMP(creation_date) FROM characters WHERE guid = '{}'", guid);
4939 PreparedQueryResult result = holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
4940
4941 if (!result)
4942 {
4943 LOG_ERROR("entities.player", "Player ({}) not found in table `characters`, can't load. ", playerGuid.ToString());
4944 return false;
4945 }
4946
4947 Field* fields = result->Fetch();
4948
4949 uint32 dbAccountId = fields[1].Get<uint32>();
4950
4951 // check if the character's account in the db and the logged in account match.
4952 // player should be able to load/delete character only with correct account!
4953 if (dbAccountId != GetSession()->GetAccountId())
4954 {
4955 LOG_ERROR("entities.player", "Player ({}) loading from wrong account (is: {}, should be: {})", playerGuid.ToString(), GetSession()->GetAccountId(), dbAccountId);
4956 return false;
4957 }
4958
4959 if (holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED))
4960 {
4961 LOG_ERROR("entities.player", "Player ({}) is banned, can't load.", playerGuid.ToString());
4962 return false;
4963 }
4964
4965 ObjectGuid::LowType guid = playerGuid.GetCounter();
4966
4968
4969 m_name = fields[2].Get<std::string>();
4970
4971 // check name limitations
4973 {
4975 stmt->SetData(0, uint16(AT_LOGIN_RENAME));
4976 stmt->SetData(1, guid);
4977 CharacterDatabase.Execute(stmt);
4978 return false;
4979 }
4980
4981 uint8 Gender = fields[5].Get<uint8>();
4982 if (!IsValidGender(Gender))
4983 {
4984 LOG_ERROR("entities.player", "Player (GUID: {}) has wrong gender ({}), can't be loaded.", guid, Gender);
4985 return false;
4986 }
4987
4988 // overwrite some data fields
4989 uint32 bytes0 = 0;
4990 bytes0 |= fields[3].Get<uint8>(); // race
4991 bytes0 |= fields[4].Get<uint8>() << 8; // class
4992 bytes0 |= Gender << 16; // gender
4994
4995 m_realRace = fields[3].Get<uint8>(); // set real race
4996 m_race = fields[3].Get<uint8>(); // set real race
4997
4998 SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].Get<uint8>());
4999 SetUInt32Value(PLAYER_XP, fields[7].Get<uint32>());
5000
5001 if (!_LoadIntoDataField(fields[66].Get<std::string>(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE))
5002 {
5003 LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid exploredzones data ({}). Forcing partial load.", guid, fields[66].Get<std::string_view>());
5004 }
5005
5006 if (!_LoadIntoDataField(fields[69].Get<std::string>(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2))
5007 {
5008 LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid knowntitles mask ({}). Forcing partial load.", guid, fields[69].Get<std::string_view>());
5009 }
5010
5011 SetObjectScale(1.0f);
5013
5014 // load character creation date, relevant for achievements of type average
5015 SetCreationTime(fields[74].Get<Seconds>());
5016
5017 // load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
5019
5020 uint32 money = fields[8].Get<uint32>();
5021 if (money > MAX_MONEY_AMOUNT)
5022 money = MAX_MONEY_AMOUNT;
5023 SetMoney(money);
5024
5025 SetByteValue(PLAYER_BYTES, 0, fields[9].Get<uint8>());
5026 SetByteValue(PLAYER_BYTES, 1, fields[10].Get<uint8>());
5027 SetByteValue(PLAYER_BYTES, 2, fields[11].Get<uint8>());
5028 SetByteValue(PLAYER_BYTES, 3, fields[12].Get<uint8>());
5029 SetByteValue(PLAYER_BYTES_2, 0, fields[13].Get<uint8>());
5030 SetByteValue(PLAYER_BYTES_2, 2, fields[14].Get<uint8>());
5031 SetByteValue(PLAYER_BYTES_2, 3, fields[15].Get<uint8>());
5032 SetByteValue(PLAYER_BYTES_3, 0, fields[5].Get<uint8>());
5033 SetByteValue(PLAYER_BYTES_3, 1, fields[54].Get<uint8>());
5034 ReplaceAllPlayerFlags((PlayerFlags)fields[16].Get<uint32>());
5035 SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[53].Get<uint32>());
5036
5037 SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[52].Get<uint64>());
5038
5039 SetUInt32Value(PLAYER_AMMO_ID, fields[68].Get<uint32>());
5040
5041 // set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
5042 SetByteValue(PLAYER_FIELD_BYTES, 2, fields[70].Get<uint8>());
5043
5045
5046 // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
5047 for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
5048 {
5050 SetVisibleItemSlot(slot, nullptr);
5051
5052 delete m_items[slot];
5053 m_items[slot] = nullptr;
5054 }
5055
5056 LOG_DEBUG("entities.player.loading", "Load Basic value of player {} is: ", m_name);
5058
5059 //Need to call it to initialize m_team (m_team can be calculated from race)
5060 //Other way is to saves m_team into characters table.
5062
5063 // pussywizard: create empty instance bind containers if necessary
5064 sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid);
5065
5066 // load home bind and check in same time class/race pair, it used later for restore broken positions
5067 if (!_LoadHomeBind(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND)))
5068 return false;
5069
5070 InitPrimaryProfessions(); // to max set before any spell loaded
5071
5072 // init saved position, and fix it later if problematic
5073 int32 transLowGUID = fields[35].Get<int32>();
5074 Relocate(fields[17].Get<float>(), fields[18].Get<float>(), fields[19].Get<float>(), fields[21].Get<float>());
5075 uint32 mapId = fields[20].Get<uint16>();
5076 uint32 instanceId = fields[63].Get<uint32>();
5077
5078 uint32 dungeonDiff = fields[43].Get<uint8>() & 0x0F;
5079 if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
5080 dungeonDiff = DUNGEON_DIFFICULTY_NORMAL;
5081 uint32 raidDiff = (fields[43].Get<uint8>() >> 4) & 0x0F;
5082 if (raidDiff >= MAX_RAID_DIFFICULTY)
5084 SetDungeonDifficulty(Difficulty(dungeonDiff)); // may be changed in _LoadGroup
5085 SetRaidDifficulty(Difficulty(raidDiff)); // may be changed in _LoadGroup
5086
5087 std::string taxi_nodes = fields[42].Get<std::string>();
5088
5089 auto RelocateToHomebind = [this, &mapId, &instanceId]() { mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); };
5090
5091 _LoadGroup();
5092
5094
5095 SetArenaPoints(fields[44].Get<uint32>());
5096
5097 SetHonorPoints(fields[45].Get<uint32>());
5098 SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[46].Get<uint32>());
5099 SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[47].Get<uint32>());
5100 SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[48].Get<uint32>());
5101 SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[49].Get<uint16>());
5102 SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[50].Get<uint16>());
5103
5106
5107 GetSession()->SetPlayer(this);
5108 MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
5109
5110 Map* map = nullptr;
5111
5112 // pussywizard: group changed difficulty when player was offline, teleport to the enterance of new difficulty
5113 if (mapEntry && ((mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty()) || (mapEntry->IsRaid() && raidDiff != GetRaidDifficulty())))
5114 {
5115 bool fixed = false;
5116 if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid())))
5117 {
5118 instanceId = destInstId;
5119 if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
5120 {
5121 Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
5122 fixed = true;
5123 }
5124 }
5125 if (!fixed)
5126 {
5127 RelocateToHomebind();
5128 mapEntry = sMapStore.LookupEntry(mapId);
5129 }
5130 }
5131
5132 if (!mapEntry || !IsPositionValid())
5133 {
5134 LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (MapId: {} X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5135 RelocateToHomebind();
5136 }
5137 // Player was saved in Arena or Bg
5138 else if (mapEntry->IsBattlegroundOrArena())
5139 {
5140 // xinef: resurrect player, cant log in dead without corpse
5141 {
5144 if (!IsAlive())
5145 ResurrectPlayer(1.0f);
5146 }
5147
5148 const WorldLocation& _loc = GetEntryPoint();
5149 mapId = _loc.GetMapId();
5150 instanceId = 0;
5151
5152 if (mapId == MAPID_INVALID)
5153 {
5154 RelocateToHomebind();
5155 }
5156 else
5157 {
5158 Relocate(&_loc);
5159
5160 // xinef: restore taxi flight from entry point data
5162 {
5166 }
5167 }
5168 }
5169 // currently we do not support transport in bg
5170 else if (transLowGUID != 0)
5171 {
5172 // transLowGUID > 0 ---> motion transport guid
5173 // transLowGUID < 0 ---> static transport spawn id
5174 Transport* transGO = nullptr;
5175 if (transLowGUID > 0)
5176 {
5177 ObjectGuid transGUID = ObjectGuid::Create<HighGuid::Mo_Transport>(transLowGUID);
5178 transGO = HashMapHolder<MotionTransport>::Find(transGUID);
5179 }
5180 else
5181 {
5182 map = sMapMgr->CreateMap(mapId, this);
5183 if (map)
5184 {
5185 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(std::abs(transLowGUID));
5186 if (bounds.first != bounds.second)
5187 transGO = bounds.first->second->ToTransport();
5188 }
5189 }
5190
5191 // pussywizard: must be on map, for one world tick transport is not in map and has old GetMapId(), player would be added to old map and to the transport, multithreading crashfix
5192 if (transGO && transGO->IsInWorld() && transGO->FindMap())
5193 m_transport = transGO;
5194
5195 if (m_transport)
5196 {
5197 float x = fields[31].Get<float>(), y = fields[32].Get<float>(), z = fields[33].Get<float>(), o = fields[34].Get<float>();
5201
5202 if (!Acore::IsValidMapCoord(x, y, z, o) || std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 75.0f)
5203 {
5204 m_transport = nullptr;
5207 RelocateToHomebind();
5208 }
5209 else
5210 {
5211 Relocate(x, y, z, o);
5212 mapId = m_transport->GetMapId();
5215 }
5216 }
5217 else
5218 {
5219 bool fixed = false;
5220 if (mapEntry->Instanceable())
5221 if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
5222 {
5223 fixed = true;
5224 Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
5225 }
5226 if (!fixed)
5227 RelocateToHomebind();
5228 }
5229 }
5230 // currently we do not support taxi in instance
5231 else if (!taxi_nodes.empty())
5232 {
5233 instanceId = 0;
5234 if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId(true)))
5235 {
5236 // xinef: could no load valid data for taxi, relocate to homebind and clear
5238 RelocateToHomebind();
5239 }
5240 }
5241
5242 // Map could be changed before
5243 mapEntry = sMapStore.LookupEntry(mapId);
5244 // client without expansion support
5245 if (mapEntry)
5246 {
5247 if (GetSession()->Expansion() < mapEntry->Expansion())
5248 {
5249 LOG_DEBUG("entities.player.loading", "Player {} using client without required expansion tried login at non accessible map {}", GetName(), mapId);
5250 RelocateToHomebind();
5251 }
5252
5253 // check whether player was unbound or is bound to another instance
5254 if (instanceId)
5255 {
5256 InstanceSave* save = sInstanceSaveMgr->PlayerGetInstanceSave(GetGUID(), mapId, GetDifficulty(mapEntry->IsRaid()));
5257 if (!save || save->GetInstanceId() != instanceId)
5258 instanceId = 0;
5259 }
5260 }
5261
5262 // if the player is in an instance and it has been reset in the meantime teleport him to the entrance
5263 if ((instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !mapEntry->IsBattlegroundOrArena()) || (!instanceId && mapEntry->IsDungeon()))
5264 {
5265 AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
5266 if (at)
5268 else
5269 RelocateToHomebind();
5270 }
5271
5272 // NOW player must have valid map
5273 // load the player's map here if it's not already loaded
5274 if (!map)
5275 map = sMapMgr->CreateMap(mapId, this);
5276
5277 if (!map)
5278 {
5279 instanceId = 0;
5280 AreaTriggerTeleport const* at = sObjectMgr->GetGoBackTrigger(mapId);
5281 if (at)
5282 {
5283 LOG_ERROR("entities.player", "Player (guidlow {}) is teleported to gobacktrigger (Map: {} X: {} Y: {} Z: {} O: {}).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5285 mapId = at->target_mapId;
5286 }
5287 else
5288 {
5289 LOG_ERROR("entities.player", "Player (guidlow {}) is teleported to home (Map: {} X: {} Y: {} Z: {} O: {}).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5290 RelocateToHomebind();
5291 }
5292
5293 map = sMapMgr->CreateMap(mapId, this);
5294 if (!map)
5295 {
5296 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
5297 mapId = info->mapId;
5298 Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
5299 LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5300 map = sMapMgr->CreateMap(mapId, this);
5301 if (!map)
5302 {
5303 LOG_ERROR("entities.player", "Player (guidlow {}) has invalid default map coordinates (X: {} Y: {} Z: {} O: {}). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5304 return false;
5305 }
5306 }
5307 }
5308
5309 SetMap(map);
5311
5313
5315
5316 time_t now = GameTime::GetGameTime().count();
5317 time_t logoutTime = time_t(fields[27].Get<uint32>());
5318
5319 // since last logout (in seconds)
5320 uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
5321
5322 // randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
5323 // this must help in case next save after mass player load after server startup
5324 m_nextSave = urand(m_nextSave / 2, m_nextSave * 3 / 2);
5325
5326 // set value, including drunk invisibility detection
5327 // calculate sobering. after 15 minutes logged out, the player will be sober again
5328 uint8 newDrunkValue = 0;
5329 if (time_diff < uint32(GetDrunkValue()) * 9)
5330 newDrunkValue = GetDrunkValue() - time_diff / 9;
5331
5332 SetDrunkValue(newDrunkValue);
5333
5334 m_cinematic = fields[23].Get<uint8>();
5335 m_Played_time[PLAYED_TIME_TOTAL] = fields[24].Get<uint32>();
5336 m_Played_time[PLAYED_TIME_LEVEL] = fields[25].Get<uint32>();
5337
5338 m_resetTalentsCost = fields[29].Get<uint32>();
5339 m_resetTalentsTime = time_t(fields[30].Get<uint32>());
5340
5341 m_taxi.LoadTaxiMask(fields[22].Get<std::string_view>()); // must be before InitTaxiNodesForLevel
5342
5343 uint32 extraflags = fields[36].Get<uint16>();
5344
5345 _LoadPetStable(fields[37].Get<uint8>(), holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS));
5346
5347 m_atLoginFlags = fields[38].Get<uint16>();
5348
5350 {
5351 LOG_ERROR("entities.player", "Player {} tried to login while forced to rename, can't load.'", GetGUID().ToString());
5352 return false;
5353 }
5354
5355 // Honor system
5356 // Update Honor kills data
5357 m_lastHonorUpdateTime = logoutTime;
5359
5360 m_deathExpireTime = time_t(fields[41].Get<uint32>());
5361
5364
5365 // clear channel spell data (if saved at channel spell casting)
5368
5369 // clear charm/summon related fields
5376
5378
5379 // reset some aura modifiers before aura apply
5382
5383 // make sure the unit is considered not in duel for proper loading
5386
5387 // reset stats before loading any modifiers
5391 InitRunes();
5392
5393 sScriptMgr->OnPlayerLoadFromDB(this);
5394
5395 // make sure the unit is considered out of combat for proper loading
5396 ClearInCombat();
5397
5398 // rest bonus can only be calculated after InitStatsForLevel()
5399 _restBonus = fields[26].Get<float>();
5400
5401 if (time_diff > 0)
5402 {
5403 //speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
5404 float bubble0 = 0.031f;
5405 //speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
5406 float bubble1 = 0.125f;
5407 float bubble = fields[28].Get<uint8>() > 0
5408 ? bubble1 * sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
5409 : bubble0 * sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
5410
5411 // Client automatically doubles the value sent so we have to divide it by 2
5412 SetRestBonus(GetRestBonus() + time_diff * ((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 144000)*bubble);
5413 }
5414
5415 uint32 innTriggerId = fields[72].Get<uint32>();
5416 if (innTriggerId)
5417 {
5418 SetRestFlag(REST_FLAG_IN_TAVERN, innTriggerId);
5419 }
5420
5421 // load skills after InitStatsForLevel because it triggering aura apply also
5422 _LoadSkills(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SKILLS));
5423 UpdateSkillsForLevel(); //update skills after load, to make sure they are correctly update at player load
5424
5425 // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
5426
5427 m_specsCount = fields[64].Get<uint8>();
5428 m_activeSpec = fields[65].Get<uint8>();
5429
5432
5433 _LoadSpells(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELLS));
5434 _LoadTalents(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_TALENTS));
5435
5436 _LoadGlyphs(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GLYPHS));
5438 _LoadAuras(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff);
5439 // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
5441 {
5444 }
5445
5446 // pussywizard: remove auras that are removed at map change (after _LoadAuras)
5448
5449 // after spell load, learn rewarded spell if need also
5450 _LoadQuestStatus(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS));
5456 _LoadRandomBGStatus(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG));
5457
5458 // Extra Bonus Talent Points
5459 m_extraBonusTalentCount = fields[73].Get<uint8>();
5460
5461 // after spell, bonus talents, and quest load
5463
5464 // must be before inventory (some items required reputation check)
5466
5467 // xinef: load mails before inventory, so problematic items can be added to already loaded mails
5468 _LoadMail(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAILS), holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS));
5469
5470 _LoadInventory(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff);
5471
5472 // update items with duration and realtime
5473 UpdateItemDuration(time_diff, true);
5474
5475 _LoadActions(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACTIONS));
5476
5477 m_social = sSocialMgr->LoadFromDB(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST), GetGUID());
5478
5479 // check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
5480 // note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
5481 uint32 curTitle = fields[51].Get<uint32>();
5482 if (curTitle && !HasTitle(curTitle))
5483 curTitle = 0;
5484
5486
5487 // has to be called after last Relocate() in Player::LoadFromDB
5489
5491
5492 // Spell code allow apply any auras to dead character in load time in aura/spell/item loading
5493 // Do now before stats re-calculation cleanup for ghost state unexpected auras
5494 if (!IsAlive())
5496 else
5498
5499 //apply all stat bonuses from items and auras
5500 SetCanModifyStats(true);
5502
5503 // restore remembered power/health values (but not more max values)
5504 uint32 savedHealth = fields[55].Get<uint32>();
5505 SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
5506 for (uint8 i = 0; i < MAX_POWERS; ++i)
5507 {
5508 uint32 savedPower = fields[56 + i].Get<uint32>();
5509 SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower);
5510 }
5511
5512 LOG_DEBUG("entities.player.loading", "The value of player {} after load item and aura is: ", m_name);
5514
5515 // GM state
5517 {
5518 switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE))
5519 {
5520 default:
5521 case 0:
5522 break; // disable
5523 case 1:
5524 SetGameMaster(true);
5525 break; // enable
5526 case 2: // save state
5527 if (extraflags & PLAYER_EXTRA_GM_ON)
5528 SetGameMaster(true);
5529 break;
5530 }
5531
5532 switch (sWorld->getIntConfig(CONFIG_GM_VISIBLE_STATE))
5533 {
5534 default:
5535 case 0:
5536 SetGMVisible(false);
5537 break; // invisible
5538 case 1:
5539 break; // visible
5540 case 2: // save state
5541 if (extraflags & PLAYER_EXTRA_GM_INVISIBLE)
5542 SetGMVisible(false);
5543 break;
5544 }
5545
5546 switch (sWorld->getIntConfig(CONFIG_GM_CHAT))
5547 {
5548 default:
5549 case 0:
5550 break; // disable
5551 case 1:
5552 SetGMChat(true);
5553 break; // enable
5554 case 2: // save state
5555 if (extraflags & PLAYER_EXTRA_GM_CHAT)
5556 SetGMChat(true);
5557 break;
5558 }
5559
5560 switch (sWorld->getIntConfig(CONFIG_GM_WHISPERING_TO))
5561 {
5562 default:
5563 case 0:
5564 break; // disable
5565 case 1:
5566 SetAcceptWhispers(true);
5567 break; // enable
5568 case 2: // save state
5569 if (extraflags & PLAYER_EXTRA_ACCEPT_WHISPERS)
5570 SetAcceptWhispers(true);
5571 break;
5572 }
5573 }
5574
5575 // RaF stuff.
5576 m_grantableLevels = fields[71].Get<uint8>();
5577 if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
5579
5580 if (m_grantableLevels > 0)
5582
5584
5585 //m_achievementMgr->CheckAllAchievementCriteria(); // pussywizard: disabled this
5586
5588
5590
5592
5593 // Players are immune to taunt
5596
5597 // Init charm info
5599
5600 // Fix aurastate auras, depending on health!
5601 // Set aurastate manualy, prevents aura switching
5602 if (HealthBelowPct(20))
5604 if (HealthBelowPct(35))
5606 if (HealthAbovePct(75))
5608
5609 // unapply aura stats if dont meet requirements
5610 AuraApplicationMap const& Auras = GetAppliedAuras();
5611 for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
5612 {
5613 // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching
5614 Aura* aura = itr->second->GetBase();
5615 SpellInfo const* m_spellInfo = aura->GetSpellInfo();
5619 continue;
5620
5621 if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState))
5622 aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false);
5623 }
5624 return true;
5625}
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition CharacterDatabase.h:276
#define MAX_RAID_DIFFICULTY
Definition DBCEnums.h:282
#define MAX_DUNGEON_DIFFICULTY
Definition DBCEnums.h:281
@ REST_FLAG_IN_TAVERN
Definition Player.h:821
@ PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS
Definition Player.h:883
@ PLAYER_LOGIN_QUERY_LOAD_GLYPHS
Definition Player.h:889
@ PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES
Definition Player.h:884
@ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW
Definition Player.h:896
@ PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS
Definition Player.h:875
@ PLAYER_LOGIN_QUERY_LOAD_CHARACTER_SETTINGS
Definition Player.h:902
@ PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES
Definition Player.h:897
@ PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS
Definition Player.h:898
@ PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST
Definition Player.h:881
@ PLAYER_LOGIN_QUERY_LOAD_ACTIONS
Definition Player.h:878
@ PLAYER_LOGIN_QUERY_LOAD_SKILLS
Definition Player.h:892
@ PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS
Definition Player.h:880
@ PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS
Definition Player.h:903
@ PLAYER_LOGIN_QUERY_LOAD_INVENTORY
Definition Player.h:877
@ PLAYER_LOGIN_QUERY_LOAD_REPUTATION
Definition Player.h:876
@ PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH
Definition Player.h:900
@ PLAYER_LOGIN_QUERY_LOAD_FROM
Definition Player.h:871
@ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS
Definition Player.h:874
@ PLAYER_LOGIN_QUERY_LOAD_ENTRY_POINT
Definition Player.h:888
@ PLAYER_LOGIN_QUERY_LOAD_OFFLINE_ACHIEVEMENTS_UPDATES
Definition Player.h:904
@ PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS
Definition Player.h:893
@ PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS
Definition Player.h:899
@ PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS
Definition Player.h:887
@ PLAYER_LOGIN_QUERY_LOAD_MAILS
Definition Player.h:879
@ PLAYER_LOGIN_QUERY_LOAD_AURAS
Definition Player.h:872
@ PLAYER_LOGIN_QUERY_LOAD_TALENTS
Definition Player.h:890
@ PLAYER_LOGIN_QUERY_LOAD_BANNED
Definition Player.h:895
@ PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS
Definition Player.h:886
@ PLAYER_LOGIN_QUERY_LOAD_HOME_BIND
Definition Player.h:882
@ PLAYER_LOGIN_QUERY_LOAD_SPELLS
Definition Player.h:873
@ PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG
Definition Player.h:894
@ PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS
Definition Player.h:885
@ SPELL_EFFECT_ATTACK_ME
Definition SharedDefines.h:892
@ CHAR_NAME_SUCCESS
Definition SharedDefines.h:3674
@ UNIT_DYNFLAG_REFER_A_FRIEND
Definition SharedDefines.h:3366
@ IMMUNITY_STATE
Definition SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1394
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74
@ AURA_INTERRUPT_FLAG_CHANGE_MAP
Definition SpellDefines.h:62
@ MOVEMENTFLAG_ONTRANSPORT
Definition UnitDefines.h:374
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition UnitDefines.h:295
@ UNIT_STATE_ISOLATED
Definition UnitDefines.h:183
@ UNIT_FIELD_CHANNEL_OBJECT
Definition UpdateFields.h:93
@ UNIT_FIELD_SUMMON
Definition UpdateFields.h:87
@ UNIT_FIELD_CHARMEDBY
Definition UpdateFields.h:89
@ UNIT_FIELD_CHARM
Definition UpdateFields.h:86
@ PLAYER_TRACK_CREATURES
Definition UpdateFields.h:344
@ PLAYER_TRACK_RESOURCES
Definition UpdateFields.h:345
@ UNIT_CHANNEL_SPELL
Definition UpdateFields.h:94
@ CONFIG_GM_CHAT
Definition WorldConfig.h:206
@ CONFIG_GM_WHISPERING_TO
Definition WorldConfig.h:207
@ RATE_REST_OFFLINE_IN_WILDERNESS
Definition WorldConfig.h:455
@ RATE_REST_OFFLINE_IN_TAVERN_OR_CITY
Definition WorldConfig.h:454
@ CONFIG_GM_LOGIN_STATE
Definition WorldConfig.h:204
@ CONFIG_GM_VISIBLE_STATE
Definition WorldConfig.h:205
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult, PreparedQueryResult offlineUpdatesResult)
Definition AchievementMgr.cpp:618
Transport * ToTransport()
Definition GameObject.h:320
static T * Find(ObjectGuid guid)
Definition ObjectAccessor.cpp:53
uint32 GetInstanceId() const
Definition InstanceSaveMgr.h:61
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition Map.h:349
static uint8 CheckPlayerName(std::string_view name, bool create=false)
Definition ObjectMgr.cpp:8641
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:124
bool _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
Definition Object.cpp:601
bool LoadTaxiMask(std::string_view data)
Definition PlayerTaxi.cpp:89
bool LoadTaxiDestinationsFromString(std::string const &values, TeamId teamId)
Definition PlayerTaxi.cpp:130
void _LoadDeclinedNames(PreparedQueryResult result)
Definition PlayerStorage.cpp:4792
void _LoadGlyphs(PreparedQueryResult result)
Definition Player.cpp:14925
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition Player.cpp:16117
void SetCreationTime(Seconds creationTime)
Definition Player.h:2555
void SetGameMaster(bool on)
Definition Player.cpp:2219
void _LoadQuestStatusRewarded(PreparedQueryResult result)
Definition PlayerStorage.cpp:6322
void _LoadAuras(PreparedQueryResult result, uint32 timediff)
Definition PlayerStorage.cpp:5707
void _LoadSeasonalQuestStatus(PreparedQueryResult result)
Definition PlayerStorage.cpp:6430
void _LoadGroup()
Definition PlayerStorage.cpp:6495
void _LoadCharacterSettings(PreparedQueryResult result)
Definition PlayerSettings.cpp:26
void _LoadTalents(PreparedQueryResult result)
Definition Player.cpp:14974
void SetFallInformation(uint32 time, float z)
Definition Player.h:2354
void _LoadPetStable(uint8 petStableSlots, PreparedQueryResult result)
Definition Player.cpp:15786
void _LoadBrewOfTheMonth(PreparedQueryResult result)
Definition Player.cpp:15749
WorldLocation const & GetEntryPoint() const
Definition Player.h:2395
void outDebugValues() const
Definition PlayerStorage.cpp:7796
void _LoadRandomBGStatus(PreparedQueryResult result)
Definition Player.cpp:15684
void SaveRecallPosition()
Definition Player.cpp:5693
void _LoadQuestStatus(PreparedQueryResult result)
Definition PlayerStorage.cpp:6235
void _LoadMonthlyQuestStatus(PreparedQueryResult result)
Definition PlayerStorage.cpp:6453
void SetGMChat(bool on)
Definition Player.h:1180
void _LoadArenaTeamInfo()
Definition PlayerStorage.cpp:4803
bool _LoadHomeBind(PreparedQueryResult result)
Definition PlayerStorage.cpp:7002
void UpdateItemDuration(uint32 time, bool realtimeonly=false)
Definition PlayerStorage.cpp:4145
void _LoadSpells(PreparedQueryResult result)
Definition PlayerStorage.cpp:6475
void _LoadSkills(PreparedQueryResult result)
Definition Player.cpp:13638
void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
Definition PlayerStorage.cpp:6162
void _LoadWeeklyQuestStatus(PreparedQueryResult result)
Definition PlayerStorage.cpp:6408
void SetGMVisible(bool on)
Definition Player.cpp:2288
void PrepareCharmAISpells()
Definition Player.cpp:15380
void _LoadGlyphAuras()
Definition PlayerStorage.cpp:5790
void ReplaceAllPlayerFlags(PlayerFlags flags)
Definition Player.h:1130
void _LoadEquipmentSets(PreparedQueryResult result)
Definition PlayerStorage.cpp:4834
void _LoadEntryPointData(PreparedQueryResult result)
Definition PlayerStorage.cpp:4865
void _LoadInstanceTimeRestrictions(PreparedQueryResult result)
Definition Player.cpp:15737
void StoreRaidMapDifficulty()
Definition Player.h:1939
void _LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Definition PlayerStorage.cpp:5842
void UpdateHonorFields()
Definition PlayerUpdates.cpp:1182
void _LoadSpellCooldowns(PreparedQueryResult result)
Definition Player.cpp:3612
void SetMoney(uint32 value)
Definition Player.h:1631
void _LoadDailyQuestStatus(PreparedQueryResult result)
Definition PlayerStorage.cpp:6357
void LoadFromDB(PreparedQueryResult result)
Definition ReputationMgr.cpp:564
uint32 CasterAuraState
Definition SpellInfo.h:339
virtual void AddPassenger(WorldObject *passenger, bool withAll=false)=0
void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied transport offsets into global coordinates.
Definition Transport.h:33
bool HealthAbovePct(int32 pct) const
Definition Unit.h:1041
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:13474
void RemoveAllAurasRequiringDeadTarget()
Definition Unit.cpp:5428
DeathState m_deathState
Definition Unit.h:2067
void RemoveAllAurasOnDeath()
Definition Unit.cpp:5405
void AddUnitState(uint32 f)
Definition Unit.h:690
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1039
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:727
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:710
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:10659
void ClearInCombat()
Definition Unit.cpp:13901
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:671
bool HasSpiritOfRedemptionAura() const
Definition Unit.h:1718
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5237
Transport * m_transport
Definition Object.h:735
void SetPlayer(Player *player)
Definition WorldSession.cpp:1307
bool IsARecruiter() const
Definition WorldSession.h:546
bool IsValidMapCoord(float c)
Definition GridDefines.h:206
Definition ObjectMgr.h:411
float target_Z
Definition ObjectMgr.h:415
float target_X
Definition ObjectMgr.h:413
float target_Orientation
Definition ObjectMgr.h:416
float target_Y
Definition ObjectMgr.h:414
uint32 target_mapId
Definition ObjectMgr.h:412
void ClearTaxiPath()
Definition Player.h:1066
bool HasTaxiPath() const
Definition Player.h:1067
bool IsNonRaidDungeon() const
Definition DBCStructure.h:1353
uint32 Expansion() const
Definition DBCStructure.h:1350
bool IsBattlegroundOrArena() const
Definition DBCStructure.h:1358
bool IsDungeon() const
Definition DBCStructure.h:1352
bool IsRaid() const
Definition DBCStructure.h:1355
bool Instanceable() const
Definition DBCStructure.h:1354
void Reset()
Definition Object.h:299
ObjectGuid guid
Definition Object.h:308
Position pos
Definition Object.h:309
void RemoveMovementFlag(uint32 flag)
Definition Object.h:345
struct MovementInfo::TransportInfo transport
bool IsPositionValid() const
Definition Position.cpp:176

References Object::_Create(), _LoadActions(), _LoadArenaTeamInfo(), _LoadAuras(), _LoadBrewOfTheMonth(), _LoadCharacterSettings(), _LoadDailyQuestStatus(), _LoadDeclinedNames(), _LoadEntryPointData(), _LoadEquipmentSets(), _LoadGlyphAuras(), _LoadGlyphs(), _LoadGroup(), _LoadHomeBind(), _LoadInstanceTimeRestrictions(), Object::_LoadIntoDataField(), _LoadInventory(), _LoadMail(), _LoadMonthlyQuestStatus(), _LoadPetStable(), _LoadQuestStatus(), _LoadQuestStatusRewarded(), _LoadRandomBGStatus(), _LoadSeasonalQuestStatus(), _LoadSkills(), _LoadSpellCooldowns(), _LoadSpells(), _LoadTalents(), _LoadWeeklyQuestStatus(), _restBonus, Transport::AddPassenger(), PlayerTaxi::AddTaxiDestination(), Unit::AddUnitMovementFlag(), Unit::AddUnitState(), Unit::ApplySpellImmune(), AT_LOGIN_RENAME, AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_CHANGE_MAP, AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, Transport::CalculatePassengerPosition(), SpellInfo::CasterAuraState, CHAR_NAME_SUCCESS, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, ObjectMgr::CheckPlayerName(), Unit::ClearInCombat(), PlayerTaxi::ClearTaxiDestinations(), EntryPointData::ClearTaxiPath(), CONFIG_GM_CHAT, CONFIG_GM_LOGIN_STATE, CONFIG_GM_VISIBLE_STATE, CONFIG_GM_WHISPERING_TO, Dead, DEATH_EXPIRE_STEP, DUNGEON_DIFFICULTY_NORMAL, ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, MapEntry::Expansion(), HashMapHolder< T >::Find(), WorldObject::FindMap(), Field::Get(), WorldSession::GetAccountId(), Unit::GetAppliedAuras(), Unit::getClass(), ObjectGuid::GetCounter(), GetDifficulty(), GetDrunkValue(), GetDungeonDifficulty(), GetEntryPoint(), Map::GetGameObjectBySpawnIdStore(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGUID(), InstanceSave::GetInstanceId(), WorldLocation::GetMapId(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetName(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), SQLQueryHolderBase::GetPreparedResult(), Unit::getRace(), GetRaidDifficulty(), WorldSession::GetRecruiterId(), GetRestBonus(), GetSession(), Aura::GetSpellInfo(), GetTeamId(), Object::GetUInt32Value(), MovementInfo::TransportInfo::guid, Aura::HandleAllEffects(), HasAtLoginFlag(), Unit::HasAuraState(), HasPlayerFlag(), Unit::HasSpiritOfRedemptionAura(), EntryPointData::HasTaxiPath(), HasTitle(), Unit::HealthAbovePct(), Unit::HealthBelowPct(), IMMUNITY_EFFECT, IMMUNITY_STATE, InitDisplayIds(), InitGlyphsForLevel(), InitPrimaryProfessions(), InitRunes(), InitStatsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), MapEntry::Instanceable(), Unit::IsAlive(), WorldSession::IsARecruiter(), MapEntry::IsBattlegroundOrArena(), MapEntry::IsDungeon(), Object::IsInWorld(), MapEntry::IsNonRaidDungeon(), AccountMgr::IsPlayerAccount(), Position::IsPositionValid(), MapEntry::IsRaid(), IsValidGender(), Acore::IsValidMapCoord(), KNOWN_TITLES_SIZE, LearnCustomSpells(), LearnDefaultSkills(), AchievementMgr::LoadFromDB(), ReputationMgr::LoadFromDB(), PlayerTaxi::LoadTaxiDestinationsFromString(), PlayerTaxi::LoadTaxiMask(), LOG_DEBUG, LOG_ERROR, LOG_WARN, m_achievementMgr, m_activeSpec, m_atLoginFlags, m_cinematic, m_deathExpireTime, Unit::m_deathState, m_entryPointData, m_extraBonusTalentCount, m_grantableLevels, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_items, m_lastHonorUpdateTime, WorldObject::m_movementInfo, WorldObject::m_name, m_nextSave, m_Played_time, Unit::m_race, Unit::m_realRace, m_reputationMgr, m_resetTalentsCost, m_resetTalentsTime, m_social, m_specsCount, m_taxi, WorldObject::m_transport, PlayerInfo::mapId, MAPID_INVALID, MAX_DEATH_COUNT, MAX_DUNGEON_DIFFICULTY, MAX_MONEY_AMOUNT, MAX_POWERS, MAX_RAID_DIFFICULTY, MOVEMENTFLAG_ONTRANSPORT, outDebugValues(), PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, Player, PLAYER__FIELD_KNOWN_TITLES, PLAYER_AMMO_ID, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_DUEL_ARBITER, PLAYER_DUEL_TEAM, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, PLAYER_EXTRA_ACCEPT_WHISPERS, PLAYER_EXTRA_GM_CHAT, PLAYER_EXTRA_GM_INVISIBLE, PLAYER_EXTRA_GM_ON, PLAYER_FARSIGHT, PLAYER_FIELD_BYTES, PLAYER_FIELD_INV_SLOT_HEAD, PLAYER_FIELD_KILLS, PLAYER_FIELD_KNOWN_CURRENCIES, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_FLAGS_GHOST, PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS, PLAYER_LOGIN_QUERY_LOAD_ACTIONS, PLAYER_LOGIN_QUERY_LOAD_AURAS, PLAYER_LOGIN_QUERY_LOAD_BANNED, PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH, PLAYER_LOGIN_QUERY_LOAD_CHARACTER_SETTINGS, PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS, PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES, PLAYER_LOGIN_QUERY_LOAD_ENTRY_POINT, PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS, PLAYER_LOGIN_QUERY_LOAD_FROM, PLAYER_LOGIN_QUERY_LOAD_GLYPHS, PLAYER_LOGIN_QUERY_LOAD_HOME_BIND, PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, PLAYER_LOGIN_QUERY_LOAD_INVENTORY, PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS, PLAYER_LOGIN_QUERY_LOAD_MAILS, PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_OFFLINE_ACHIEVEMENTS_UPDATES, PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS, PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG, PLAYER_LOGIN_QUERY_LOAD_REPUTATION, PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_SKILLS, PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS, PLAYER_LOGIN_QUERY_LOAD_SPELLS, PLAYER_LOGIN_QUERY_LOAD_TALENTS, PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS, PLAYER_NEXT_LEVEL_XP, PLAYER_TRACK_CREATURES, PLAYER_TRACK_RESOURCES, PLAYER_XP, MovementInfo::TransportInfo::pos, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, PrepareCharmAISpells(), RAID_DIFFICULTY_10MAN_NORMAL, RATE_REST_OFFLINE_IN_TAVERN_OR_CITY, RATE_REST_OFFLINE_IN_WILDERNESS, Position::Relocate(), Unit::RemoveAllAurasOnDeath(), Unit::RemoveAllAurasRequiringDeadTarget(), Unit::RemoveAurasByType(), Unit::RemoveAurasWithInterruptFlags(), MovementInfo::RemoveMovementFlag(), Unit::RemoveUnitFlag2(), ReplaceAllPlayerFlags(), MovementInfo::TransportInfo::Reset(), REST_FLAG_IN_TAVERN, ResurrectPlayer(), SaveRecallPosition(), SetAcceptWhispers(), SetArenaPoints(), Object::SetByteValue(), Unit::SetCanModifyStats(), SetCreationTime(), Unit::SetCreatorGUID(), PreparedStatementBase::SetData(), SetDrunkValue(), SetDungeonDifficulty(), Object::SetDynamicFlag(), SetFactionForRace(), SetFallInformation(), Object::SetFlag(), Object::SetFloatValue(), SetGameMaster(), SetGMChat(), SetGMVisible(), Object::SetGuidValue(), Unit::SetHealth(), SetHonorPoints(), Object::SetInt32Value(), SetMap(), SetMoney(), SetObjectScale(), Unit::SetOwnerGUID(), WorldSession::SetPlayer(), Unit::SetPower(), SetRaidDifficulty(), SetRestBonus(), SetRestFlag(), Object::SetUInt16Value(), Unit::SetUInt32Value(), Object::SetUInt64Value(), SetVisibleItemSlot(), sInstanceSaveMgr, sMapMgr, sMapStore, sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOD_TAUNT, SPELL_EFFECT_ATTACK_ME, sScriptMgr, sSocialMgr, StoreRaidMapDifficulty(), sWorld, AreaTriggerTeleport::target_mapId, AreaTriggerTeleport::target_Orientation, AreaTriggerTeleport::target_X, AreaTriggerTeleport::target_Y, AreaTriggerTeleport::target_Z, EntryPointData::taxiPath, ObjectGuid::ToString(), Position::ToString(), GameObject::ToTransport(), MovementInfo::transport, UNIT_CHANNEL_SPELL, UNIT_DYNFLAG_REFER_A_FRIEND, UNIT_FIELD_AURASTATE, UNIT_FIELD_BYTES_0, UNIT_FIELD_CHANNEL_OBJECT, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FIELD_HOVERHEIGHT, UNIT_FIELD_LEVEL, UNIT_FIELD_SUMMON, UNIT_FLAG2_FORCE_MOVEMENT, UNIT_STATE_ISOLATED, UpdateAllStats(), UpdateHonorFields(), UpdateItemDuration(), WorldObject::UpdatePositionData(), UpdateSkillsForLevel(), and urand().

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadPet()

void Player::LoadPet ( )
6224{
6225 //fixme: the pet should still be loaded if the player is not in world
6226 // just not added to the map
6227 if (m_petStable && IsInWorld())
6228 {
6229 Pet* pet = new Pet(this);
6230 if (!pet->LoadPetFromDB(this, 0, 0, true))
6231 delete pet;
6232 }
6233}
bool LoadPetFromDB(Player *owner, uint32 petEntry, uint32 petnumber, bool current, uint32 healthPct=0, bool fullMana=false)
Definition Pet.cpp:216

References Object::IsInWorld(), Pet::LoadPetFromDB(), and m_petStable.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadPositionFromDB()

bool Player::LoadPositionFromDB ( uint32 mapid,
float &  x,
float &  y,
float &  z,
float &  o,
bool &  in_flight,
ObjectGuid::LowType  guid 
)
static
4883{
4885 stmt->SetData(0, guid);
4886 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4887
4888 if (!result)
4889 return false;
4890
4891 Field* fields = result->Fetch();
4892
4893 x = fields[0].Get<float>();
4894 y = fields[1].Get<float>();
4895 z = fields[2].Get<float>();
4896 o = fields[3].Get<float>();
4897 mapid = fields[4].Get<uint16>();
4898 in_flight = !fields[5].Get<std::string>().empty();
4899
4900 return true;
4901}
@ CHAR_SEL_CHAR_POSITION
Definition CharacterDatabase.h:54

References CHAR_SEL_CHAR_POSITION, CharacterDatabase, Field::Get(), and PreparedStatementBase::SetData().

Referenced by misc_commandscript::HandleAppearCommand().

◆ ModifyArenaPoints()

void Player::ModifyArenaPoints ( int32  value,
CharacterDatabaseTransaction  trans = CharacterDatabaseTransaction(nullptr) 
)

If trans is specified, honor save query will be added to trans.

6321{
6322 int32 newValue = int32(GetArenaPoints()) + value;
6323 if (newValue < 0)
6324 newValue = 0;
6325 SetArenaPoints(uint32(newValue));
6326
6327 if (trans)
6328 {
6330 stmt->SetData(0, newValue);
6331 stmt->SetData(1, GetGUID().GetCounter());
6332 trans->Append(stmt);
6333 }
6334}
@ CHAR_UDP_CHAR_ARENA_POINTS
Definition CharacterDatabase.h:427

References CHAR_UDP_CHAR_ARENA_POINTS, CharacterDatabase, GetArenaPoints(), Object::GetGUID(), SetArenaPoints(), and PreparedStatementBase::SetData().

Referenced by _StoreOrEquipNewItem(), modify_commandscript::HandleModifyArenaCommand(), RefundItem(), and RewardQuest().

◆ ModifyHonorPoints()

void Player::ModifyHonorPoints ( int32  value,
CharacterDatabaseTransaction  trans = CharacterDatabaseTransaction(nullptr) 
)
6305{
6306 int32 newValue = int32(GetHonorPoints()) + value;
6307 if (newValue < 0)
6308 newValue = 0;
6309 SetHonorPoints(uint32(newValue));
6310
6311 if (trans)
6312 {
6314 stmt->SetData(0, newValue);
6315 stmt->SetData(1, GetGUID().GetCounter());
6316 trans->Append(stmt);
6317 }
6318}
@ CHAR_UDP_CHAR_HONOR_POINTS
Definition CharacterDatabase.h:425

References CHAR_UDP_CHAR_HONOR_POINTS, CharacterDatabase, Object::GetGUID(), GetHonorPoints(), PreparedStatementBase::SetData(), and SetHonorPoints().

Referenced by _StoreOrEquipNewItem(), modify_commandscript::HandleModifyHonorCommand(), RefundItem(), and RewardHonor().

◆ ModifyMoney()

bool Player::ModifyMoney ( int32  amount,
bool  sendError = true 
)
11485{
11486 if (!amount)
11487 return true;
11488
11489 sScriptMgr->OnPlayerMoneyChanged(this, amount);
11490
11491 if (amount < 0)
11492 SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
11493 else
11494 {
11495 if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
11496 SetMoney(GetMoney() + amount);
11497 else
11498 {
11499 if (sendError)
11500 SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
11501 return false;
11502 }
11503 }
11504
11505 return true;
11506}
@ EQUIP_ERR_TOO_MUCH_GOLD
Definition Item.h:123

References EQUIP_ERR_TOO_MUCH_GOLD, GetMoney(), MAX_MONEY_AMOUNT, SendEquipError(), SetMoney(), and sScriptMgr.

Referenced by _StoreOrEquipNewItem(), ActivateTaxiPathTo(), FlightPathMovementGenerator::DoUpdate(), DurabilityRepair(), WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAlterAppearance(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyBankSlotOpcode(), Guild::HandleBuyBankTab(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), modify_commandscript::HandleModifyMoneyCommand(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), Guild::HandleSetEmblem(), WorldSession::HandleTrainerBuySpellOpcode(), npc_experience::OnGossipSelect(), OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), ProcessCastaction(), ProcessUnlearnAction(), RefundItem(), resetTalents(), RewardQuest(), and SetHonorPoints().

◆ ModifySkillBonus()

void Player::ModifySkillBonus ( uint32  skillid,
int32  val,
bool  talent 
)
5343{
5344 SkillStatusMap::const_iterator itr = mSkillStatus.find(skillid);
5345 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5346 return;
5347
5348 uint32 bonusIndex = PLAYER_SKILL_BONUS_INDEX(itr->second.pos);
5349
5350 uint32 bonus_val = GetUInt32Value(bonusIndex);
5351 int16 temp_bonus = SKILL_TEMP_BONUS(bonus_val);
5352 int16 perm_bonus = SKILL_PERM_BONUS(bonus_val);
5353
5354 if (talent) // permanent bonus stored in high part
5355 SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus, perm_bonus + val));
5356 else // temporary/item bonus stored in low part
5357 SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus + val, perm_bonus));
5358}
#define MAKE_SKILL_BONUS(t, p)
Definition Player.h:88

References Object::GetUInt32Value(), MAKE_SKILL_BONUS, mSkillStatus, PLAYER_SKILL_BONUS_INDEX, Unit::SetUInt32Value(), SKILL_DELETED, SKILL_PERM_BONUS, and SKILL_TEMP_BONUS.

Referenced by AuraEffect::HandleAuraModSkill().

◆ ModifySpellCooldown()

void Player::ModifySpellCooldown ( uint32  spellId,
int32  cooldown 
)
11072{
11073 SpellCooldowns::iterator itr = m_spellCooldowns.find(spellId);
11074 if (itr == m_spellCooldowns.end())
11075 return;
11076
11077 itr->second.end += cooldown;
11078
11079 WorldPacket data(SMSG_MODIFY_COOLDOWN, 4 + 8 + 4);
11080 data << uint32(spellId); // Spell ID
11081 data << GetGUID(); // Player GUID
11082 data << int32(cooldown); // Cooldown mod in milliseconds
11083 GetSession()->SendPacket(&data);
11084}
@ SMSG_MODIFY_COOLDOWN
Definition Opcodes.h:1199

References Object::GetGUID(), GetSession(), m_spellCooldowns, WorldSession::SendPacket(), and SMSG_MODIFY_COOLDOWN.

◆ MoneyChanged()

void Player::MoneyChanged ( uint32  value)
2172{
2173 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2174 {
2175 uint32 questid = GetQuestSlotQuestId(i);
2176 if (!questid)
2177 continue;
2178
2179 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2180 {
2181 int32 rewOrReqMoney = qInfo->GetRewOrReqMoney();
2182 if (rewOrReqMoney < 0)
2183 {
2184 QuestStatusData& q_status = m_QuestStatus[questid];
2185
2186 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2187 {
2188 if (int32(count) >= -rewOrReqMoney)
2189 {
2190 if (CanCompleteQuest(questid))
2191 {
2192 CompleteQuest(questid);
2193 }
2194 }
2195 }
2196 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2197 {
2198 if (int32(count) < -rewOrReqMoney)
2199 {
2200 IncompleteQuest(questid);
2201 }
2202 }
2203 }
2204 }
2205 }
2206}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by SetMoney().

◆ MoveItemFromInventory()

void Player::MoveItemFromInventory ( uint8  bag,
uint8  slot,
bool  update 
)
2979{
2980 if (Item* it = GetItemByPos(bag, slot))
2981 {
2982 ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
2983 RemoveItem(bag, slot, update);
2985 it->SetNotRefundable(this, false);
2986 it->RemoveFromUpdateQueueOf(this);
2987 if (it->IsInWorld())
2988 {
2989 it->RemoveFromWorld();
2990 it->DestroyForPlayer(this);
2991 }
2992
2993 sScriptMgr->OnPlayerAfterMoveItemFromInventory(this, it, bag, slot, update);
2994 }
2995}

References GetItemByPos(), ItemRemovedQuestCheck(), RemoveItem(), sScriptMgr, and UpdateTitansGrip().

Referenced by AutoUnequipOffhandIfNeed(), WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAuctionSellItem(), and WorldSession::HandleSendMail().

◆ MoveItemToInventory()

void Player::MoveItemToInventory ( ItemPosCountVec const &  dest,
Item pItem,
bool  update,
bool  in_characterInventoryDB = false 
)
2999{
3000 // update quest counters
3001 ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
3003
3004 // store item
3005 Item* pLastItem = StoreItem(dest, pItem, update);
3006
3007 // only set if not merged to existed stack (pItem can be deleted already but we can compare pointers any way)
3008 if (pLastItem == pItem)
3009 {
3010 // update owner for last item (this can be original item with wrong owner
3011 if (pLastItem->GetOwnerGUID() != GetGUID())
3012 pLastItem->SetOwnerGUID(GetGUID());
3013
3014 // if this original item then it need create record in inventory
3015 // in case trade we already have item in other player inventory
3016 pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this);
3017
3018 if (pLastItem->IsBOPTradable())
3019 AddTradeableItem(pLastItem);
3020 }
3021}
ObjectGuid GetOwnerGUID() const
Definition Item.h:231

References ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, AddTradeableItem(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Item::GetOwnerGUID(), Item::IsBOPTradable(), ITEM_CHANGED, ITEM_NEW, ItemAddedQuestCheck(), Item::SetOwnerGUID(), Item::SetState(), StoreItem(), and UpdateAchievementCriteria().

Referenced by WorldSession::HandleMailTakeItem(), and WorldSession::moveItems().

◆ MustDelayTeleport()

bool Player::MustDelayTeleport ( ) const
inlineprivate
2966{ return m_bMustDelayTeleport; } // pussywizard: must delay teleports during player update to the very end

References m_bMustDelayTeleport.

Referenced by TeleportTo().

◆ NeedSendSpectatorData()

bool Player::NeedSendSpectatorData ( ) const
15369{
15370 if (FindMap() && FindMap()->IsBattleArena() && !IsSpectator())
15371 {
15372 Battleground* bg = ((BattlegroundMap*)FindMap())->GetBG();
15373 if (bg && bg->HaveSpectators() && bg->GetStatus() == STATUS_IN_PROGRESS && !bg->GetPlayers().empty())
15374 if (bg->GetPlayers().find(GetGUID()) != bg->GetPlayers().end())
15375 return true;
15376 }
15377 return false;
15378}
Definition Map.h:649
bool HaveSpectators()
Definition Battleground.h:398
BattlegroundPlayerMap const & GetPlayers() const
Definition Battleground.h:409
bool IsSpectator() const
Definition Player.h:2592

References WorldObject::FindMap(), Object::GetGUID(), Battleground::GetPlayers(), Battleground::GetStatus(), Battleground::HaveSpectators(), IsSpectator(), and STATUS_IN_PROGRESS.

Referenced by _AddSpellCooldown(), Spell::cancel(), RemovePet(), Spell::SendChannelStart(), SendClearCooldown(), Spell::SendSpellStart(), setDeathState(), Unit::SetHealth(), Unit::SetMaxHealth(), Unit::SetMaxPower(), Unit::SetPower(), SetSelection(), and SummonPet().

◆ NeedToSaveGlyphs()

bool Player::NeedToSaveGlyphs ( )
inline
2617{ return m_NeedToSaveGlyphs; }

References m_NeedToSaveGlyphs.

Referenced by _SaveGlyphs().

◆ OCTRegenHPPerSpirit()

float Player::OCTRegenHPPerSpirit ( )
5251{
5252 uint8 level = GetLevel();
5253 uint32 pclass = getClass();
5254
5255 if (level > GT_MAX_LEVEL)
5256 level = GT_MAX_LEVEL;
5257
5258 GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5259 GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5260 if (!baseRatio || !moreRatio)
5261 return 0.0f;
5262
5263 // Formula from PaperDollFrame script
5264 float spirit = GetStat(STAT_SPIRIT);
5265 float baseSpirit = spirit;
5266 if (baseSpirit > 50)
5267 baseSpirit = 50;
5268 float moreSpirit = spirit - baseSpirit;
5269 float regen = (baseSpirit * baseRatio->ratio + moreSpirit * moreRatio->ratio) * 2;
5270 return regen;
5271}
DBCStorage< GtRegenHPPerSptEntry > sGtRegenHPPerSptStore(GtRegenHPPerSptfmt)
DBCStorage< GtOCTRegenHPEntry > sGtOCTRegenHPStore(GtOCTRegenHPfmt)
Definition DBCStructure.h:1083
float ratio
Definition DBCStructure.h:1084
Definition DBCStructure.h:1093
float ratio
Definition DBCStructure.h:1094

References Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtOCTRegenHPEntry::ratio, GtRegenHPPerSptEntry::ratio, sGtOCTRegenHPStore, sGtRegenHPPerSptStore, and STAT_SPIRIT.

Referenced by RegenerateHealth().

◆ OCTRegenMPPerSpirit()

float Player::OCTRegenMPPerSpirit ( )
5274{
5275 uint8 level = GetLevel();
5276 uint32 pclass = getClass();
5277
5278 if (level > GT_MAX_LEVEL)
5279 level = GT_MAX_LEVEL;
5280
5281 // GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
5282 GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5283 if (!moreRatio)
5284 return 0.0f;
5285
5286 // Formula get from PaperDollFrame script
5287 float spirit = GetStat(STAT_SPIRIT);
5288 float regen = spirit * moreRatio->ratio;
5289 return regen;
5290}
DBCStorage< GtRegenMPPerSptEntry > sGtRegenMPPerSptStore(GtRegenMPPerSptfmt)
Definition DBCStructure.h:1098
float ratio
Definition DBCStructure.h:1099

References Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtRegenMPPerSptEntry::ratio, sGtRegenMPPerSptStore, and STAT_SPIRIT.

Referenced by UpdateManaRegen().

◆ OfflineResurrect()

◆ OnGossipSelect()

void Player::OnGossipSelect ( WorldObject source,
uint32  gossipListId,
uint32  menuId 
)
245{
247
248 // if not same, then something funky is going on
249 if (menuId != gossipMenu.GetMenuId())
250 return;
251
252 GossipMenuItem const* item = gossipMenu.GetItem(gossipListId);
253 if (!item)
254 return;
255
256 uint32 gossipOptionId = item->OptionType;
257 ObjectGuid guid = source->GetGUID();
258
259 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && source->IsCreature())
260 {
262 {
264
267 else
269
271 return;
272 }
273 }
274
275 if (source->IsGameObject())
276 {
277 if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
278 {
279 LOG_ERROR("entities.player", "Player guid {} request invalid gossip option for GameObject entry {}", GetGUID().ToString(), source->GetEntry());
280 return;
281 }
282 }
283
284 GossipMenuItemData const* menuItemData = gossipMenu.GetItemData(gossipListId);
285 if (!menuItemData)
286 return;
287
288 int32 cost = int32(item->BoxMoney);
289 if (!HasEnoughMoney(cost))
290 {
293 return;
294 }
295
296 switch (gossipOptionId)
297 {
300 {
301 if (menuItemData->GossipActionPoi)
303
304 if (menuItemData->GossipActionMenuId)
305 {
306 PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
307 SendPreparedGossip(source);
308 }
309
310 break;
311 }
313 sOutdoorPvPMgr->HandleGossipOption(this, source->ToCreature(), gossipListId);
314 break;
316 if (isDead())
317 source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, nullptr, nullptr, GetGUID());
318 break;
320 PrepareQuestMenu(guid);
321 SendPreparedQuest(guid);
322 break;
325 GetSession()->SendListInventory(guid, menuItemData->GossipActionMenuId);
326 break;
328 GetSession()->SendStablePet(guid);
329 break;
332 break;
334 if (GetSpecsCount() == 1 && GetLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
335 {
336 // Cast spells that teach dual spec
337 // Both are also ImplicitTarget self and must be cast by player
338 CastSpell(this, 63680, true, nullptr, nullptr, GetGUID());
339 CastSpell(this, 63624, true, nullptr, nullptr, GetGUID());
340
341 PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
342 SendPreparedGossip(source);
343 }
344 break;
348 break;
352 break;
354 GetSession()->SendTaxiMenu(source->ToCreature());
355 break;
358 SetBindPoint(guid);
359 break;
361 GetSession()->SendShowBank(guid);
362 break;
366 break;
370 break;
372 GetSession()->SendAuctionHello(guid, source->ToCreature());
373 break;
375 PrepareGossipMenu(source);
376 SendPreparedGossip(source);
377 break;
379 {
380 BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(source->GetEntry());
381
382 if (bgTypeId == BATTLEGROUND_TYPE_NONE)
383 {
384 LOG_ERROR("entities.player", "A user ({}) requested battlegroundlist from a npc who is no battlemaster", GetGUID().ToString());
385 return;
386 }
387
388 GetSession()->SendBattleGroundList(guid, bgTypeId);
389 break;
390 }
391 }
392
393 ModifyMoney(-cost);
394}
@ GOSSIP_OPTION_AUCTIONEER
Definition GossipDef.h:48
@ GOSSIP_OPTION_UNLEARNTALENTS
Definition GossipDef.h:51
@ GOSSIP_OPTION_TRAINER
Definition GossipDef.h:40
@ GOSSIP_OPTION_ARMORER
Definition GossipDef.h:50
@ GOSSIP_OPTION_UNLEARNPETTALENTS
Definition GossipDef.h:52
@ GOSSIP_OPTION_VENDOR
Definition GossipDef.h:38
@ GOSSIP_OPTION_OUTDOORPVP
Definition GossipDef.h:54
@ GOSSIP_OPTION_BATTLEFIELD
Definition GossipDef.h:47
@ GOSSIP_OPTION_TABARDDESIGNER
Definition GossipDef.h:46
@ GOSSIP_OPTION_TAXIVENDOR
Definition GossipDef.h:39
@ GOSSIP_OPTION_QUESTGIVER
Definition GossipDef.h:37
@ GOSSIP_OPTION_LEARNDUALSPEC
Definition GossipDef.h:53
@ GOSSIP_OPTION_INNKEEPER
Definition GossipDef.h:43
@ GOSSIP_OPTION_SPIRITGUIDE
Definition GossipDef.h:42
@ GOSSIP_OPTION_DUALSPEC_INFO
Definition GossipDef.h:55
@ GOSSIP_OPTION_PETITIONER
Definition GossipDef.h:45
@ GOSSIP_OPTION_BANKER
Definition GossipDef.h:44
@ GOSSIP_OPTION_GOSSIP
Definition GossipDef.h:36
@ GOSSIP_OPTION_SPIRITHEALER
Definition GossipDef.h:41
@ GOSSIP_OPTION_STABLEPET
Definition GossipDef.h:49
@ LANG_INSTANT_FLIGHT_OFF
Definition Language.h:1328
@ LANG_INSTANT_FLIGHT_ON
Definition Language.h:1327
@ GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT
Definition Player.h:1025
BattlegroundTypeId
Definition SharedDefines.h:3734
@ BATTLEGROUND_TYPE_NONE
Definition SharedDefines.h:3735
@ UNIT_NPC_FLAG_FLIGHTMASTER
Definition UnitDefines.h:328
@ CONFIG_MIN_DUALSPEC_LEVEL
Definition WorldConfig.h:187
void SendNotification(std::string_view str)
Definition Chat.cpp:105
Definition GossipDef.h:163
GossipMenuItem const * GetItem(uint32 id) const
Definition GossipDef.h:188
uint32 GetMenuId() const
Definition GossipDef.h:172
GossipMenuItemData const * GetItemData(uint32 indexId) const
Definition GossipDef.h:197
bool IsGameObject() const
Definition Object.h:213
Unit * ToUnit()
Definition Object.h:210
void SendCloseGossip()
Definition GossipDef.cpp:239
void SendPointOfInterest(uint32 poiId) const
Definition GossipDef.cpp:247
GossipMenu & GetGossipMenu()
Definition GossipDef.h:264
void SendTalentWipeConfirm(ObjectGuid guid)
Definition Player.cpp:8908
void SendPreparedGossip(WorldObject *source)
Definition PlayerGossip.cpp:209
void SendPreparedQuest(ObjectGuid guid)
Definition PlayerQuest.cpp:115
void ToggleInstantFlight()
Definition PlayerGossip.cpp:437
void ResetPetTalents()
Definition Player.cpp:8917
void PrepareQuestMenu(ObjectGuid guid)
Definition PlayerQuest.cpp:39
void SetBindPoint(ObjectGuid guid)
Definition Player.cpp:8901
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition PlayerGossip.cpp:32
NPCFlags GetNpcFlags() const
Clears emote state (looping emote)
Definition Unit.h:717
void SendAuctionHello(ObjectGuid guid, Creature *unit)
Definition AuctionHouseHandler.cpp:53
void SendPetitionShowList(ObjectGuid guid)
Definition PetitionsHandler.cpp:824
void SendTaxiMenu(Creature *unit)
Definition TaxiHandler.cpp:84
void SendListInventory(ObjectGuid guid, uint32 vendorEntry=0)
Definition ItemHandler.cpp:1035
void SendTrainerList(ObjectGuid guid)
Definition NPCHandler.cpp:87
void SendShowBank(ObjectGuid guid)
Definition BankHandler.cpp:188
void SendStablePet(ObjectGuid guid)
Definition NPCHandler.cpp:480
void SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId=BATTLEGROUND_RB)
Definition BattleGroundHandler.cpp:67
void SendTabardVendorActivate(ObjectGuid guid)
Definition NPCHandler.cpp:65
Definition GossipDef.h:146
uint32 GossipActionMenuId
Definition GossipDef.h:147
uint32 GossipActionPoi
Definition GossipDef.h:148
Definition GossipDef.h:132
uint32 OptionType
Definition GossipDef.h:137
uint32 BoxMoney
Definition GossipDef.h:139

References BATTLEGROUND_TYPE_NONE, GossipMenuItem::BoxMoney, BUY_ERR_NOT_ENOUGHT_MONEY, Unit::CastSpell(), CONFIG_INSTANT_TAXI, CONFIG_MIN_DUALSPEC_LEVEL, Object::GetEntry(), PlayerMenu::GetGossipMenu(), Object::GetGUID(), Object::GetGUID(), GossipMenu::GetItem(), GossipMenu::GetItemData(), Unit::GetLevel(), GossipMenu::GetMenuId(), Unit::GetNpcFlags(), GetSession(), GetSpecsCount(), GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT, GOSSIP_OPTION_ARMORER, GOSSIP_OPTION_AUCTIONEER, GOSSIP_OPTION_BANKER, GOSSIP_OPTION_BATTLEFIELD, GOSSIP_OPTION_DUALSPEC_INFO, GOSSIP_OPTION_GOSSIP, GOSSIP_OPTION_INNKEEPER, GOSSIP_OPTION_LEARNDUALSPEC, GOSSIP_OPTION_OUTDOORPVP, GOSSIP_OPTION_PETITIONER, GOSSIP_OPTION_QUESTGIVER, GOSSIP_OPTION_SPIRITGUIDE, GOSSIP_OPTION_SPIRITHEALER, GOSSIP_OPTION_STABLEPET, GOSSIP_OPTION_TABARDDESIGNER, GOSSIP_OPTION_TAXIVENDOR, GOSSIP_OPTION_TRAINER, GOSSIP_OPTION_UNLEARNPETTALENTS, GOSSIP_OPTION_UNLEARNTALENTS, GOSSIP_OPTION_VENDOR, GossipMenuItemData::GossipActionMenuId, GossipMenuItemData::GossipActionPoi, HasEnoughMoney(), Object::IsCreature(), Unit::isDead(), Object::IsGameObject(), LANG_INSTANT_FLIGHT_OFF, LANG_INSTANT_FLIGHT_ON, LOG_ERROR, m_isInstantFlightOn, ModifyMoney(), GossipMenuItem::OptionType, PlayerTalkClass, PrepareGossipMenu(), PrepareQuestMenu(), ResetPetTalents(), sBattlegroundMgr, WorldSession::SendAuctionHello(), WorldSession::SendBattleGroundList(), SendBuyError(), PlayerMenu::SendCloseGossip(), WorldSession::SendListInventory(), ChatHandler::SendNotification(), WorldSession::SendPetitionShowList(), PlayerMenu::SendPointOfInterest(), SendPreparedGossip(), SendPreparedQuest(), WorldSession::SendShowBank(), WorldSession::SendStablePet(), WorldSession::SendTabardVendorActivate(), SendTalentWipeConfirm(), WorldSession::SendTaxiMenu(), WorldSession::SendTrainerList(), SetBindPoint(), sOutdoorPvPMgr, sWorld, Object::ToCreature(), ToggleInstantFlight(), Position::ToString(), Object::ToUnit(), and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by WorldSession::HandleGossipSelectOptionOpcode().

◆ outDebugValues()

void Player::outDebugValues ( ) const
protected
7797{
7798 if (!sLog->ShouldLog("entities.player", LogLevel::LOG_LEVEL_DEBUG)) // optimize disabled debug output
7799 return;
7800
7801 LOG_DEBUG("entities.player", "HP is: \t\t\t{}\t\tMP is: \t\t\t{}", GetMaxHealth(), GetMaxPower(POWER_MANA));
7802 LOG_DEBUG("entities.player", "AGILITY is: \t\t{}\t\tSTRENGTH is: \t\t{}", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH));
7803 LOG_DEBUG("entities.player", "INTELLECT is: \t\t{}\t\tSPIRIT is: \t\t{}", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT));
7804 LOG_DEBUG("entities.player", "STAMINA is: \t\t{}", GetStat(STAT_STAMINA));
7805 LOG_DEBUG("entities.player", "Armor is: \t\t{}\t\tBlock is: \t\t{}", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE));
7806 LOG_DEBUG("entities.player", "HolyRes is: \t\t{}\t\tFireRes is: \t\t{}", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE));
7807 LOG_DEBUG("entities.player", "NatureRes is: \t\t{}\t\tFrostRes is: \t\t{}", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST));
7808 LOG_DEBUG("entities.player", "ShadowRes is: \t\t{}\t\tArcaneRes is: \t\t{}", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE));
7809 LOG_DEBUG("entities.player", "MIN_DAMAGE is: \t\t{}\tMAX_DAMAGE is: \t\t{}", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE));
7810 LOG_DEBUG("entities.player", "MIN_OFFHAND_DAMAGE is: \t{}\tMAX_OFFHAND_DAMAGE is: \t{}", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE));
7811 LOG_DEBUG("entities.player", "MIN_RANGED_DAMAGE is: \t{}\tMAX_RANGED_DAMAGE is: \t{}", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE));
7812 LOG_DEBUG("entities.player", "ATTACK_TIME is: \t{}\t\tRANGE_ATTACK_TIME is: \t{}", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK));
7813}
@ LOG_LEVEL_DEBUG
Definition LogCommon.h:31
#define sLog
Definition Log.h:127
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:288
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:286
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:287
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:289
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:285
uint32 GetArmor() const
Definition Unit.h:1081

References BASE_ATTACK, Unit::GetArmor(), Unit::GetAttackTime(), Object::GetFloatValue(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetResistance(), Unit::GetStat(), LOG_DEBUG, LOG_LEVEL_DEBUG, PLAYER_BLOCK_PERCENTAGE, POWER_MANA, RANGED_ATTACK, sLog, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_SHADOW, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by LoadFromDB(), and SaveToDB().

◆ PetSpellInitialize()

void Player::PetSpellInitialize ( )
9512{
9513 Pet* pet = GetPet();
9514
9515 if (!pet)
9516 return;
9517
9518 LOG_DEBUG("entities.pet", "Pet Spells Groups");
9519
9520 CharmInfo* charmInfo = pet->GetCharmInfo();
9521
9522 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 1);
9523 data << pet->GetGUID();
9524 data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents)
9525 data << uint32(pet->GetDuration().count());
9526 data << uint8(pet->GetReactState());
9527 data << uint8(charmInfo->GetCommandState());
9528 data << uint16(0); // Flags, mostly unknown
9529
9530 // action bar loop
9531 charmInfo->BuildActionBar(&data);
9532
9533 std::size_t spellsCountPos = data.wpos();
9534
9535 // spells count
9536 uint8 addlist = 0;
9537 data << uint8(addlist); // placeholder
9538
9539 if (pet->IsPermanentPetFor(this))
9540 {
9541 // spells loop
9542 for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
9543 {
9544 if (itr->second.state == PETSPELL_REMOVED)
9545 continue;
9546
9547 data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first, itr->second.active));
9548 ++addlist;
9549 }
9550 }
9551
9552 data.put<uint8>(spellsCountPos, addlist);
9553
9554 uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size();
9555 data << uint8(cooldownsCount);
9556
9557 uint32 curTime = GameTime::GetGameTimeMS().count();
9559
9560 for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
9561 {
9562 uint16 category = itr->second.category;
9563 uint32 cooldown = (itr->second.end > curTime) ? itr->second.end - curTime : 0;
9564
9565 data << uint32(itr->first); // spellid
9566 data << uint16(itr->second.category); // spell category
9567
9568 // send infinity cooldown in special format
9569 if (itr->second.end >= infTime)
9570 {
9571 data << uint32(1); // cooldown
9572 data << uint32(0x80000000); // category cooldown
9573 continue;
9574 }
9575
9576 data << uint32(category ? 0 : cooldown); // cooldown
9577 data << uint32(category ? cooldown : 0); // category cooldown
9578 }
9579
9580 GetSession()->SendPacket(&data);
9581}
#define MAKE_UNIT_ACTION_BUTTON(A, T)
Definition CharmInfo.h:33
@ PETSPELL_REMOVED
Definition PetDefines.h:60
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition Creature.h:255
bool IsPermanentPetFor(Player *owner) const
Definition Pet.cpp:2301
Milliseconds GetDuration() const
Definition Pet.h:91
PetSpellMap m_spells
Definition Pet.h:121

References CharmInfo::BuildActionBar(), CreatureTemplate::family, Unit::GetCharmInfo(), CharmInfo::GetCommandState(), Creature::GetCreatureTemplate(), Pet::GetDuration(), GameTime::GetGameTimeMS(), Object::GetGUID(), GetPet(), Creature::GetReactState(), GetSession(), infinityCooldownDelayCheck, Pet::IsPermanentPetFor(), LOG_DEBUG, Creature::m_CreatureSpellCooldowns, Pet::m_spells, MAKE_UNIT_ACTION_BUTTON, MAX_UNIT_ACTION_BAR_INDEX, PETSPELL_REMOVED, ByteBuffer::put(), WorldSession::SendPacket(), SMSG_PET_SPELLS, and ByteBuffer::wpos().

Referenced by CreatePet(), CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectLearnPetSpell(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), AuraEffect::HandleModPossessPet(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleRequestPetInfo(), Pet::learnSpell(), Pet::LoadPetFromDB(), Pet::resetTalents(), Unit::SetMinion(), and SummonPet().

◆ PossessSpellInitialize()

void Player::PossessSpellInitialize ( )
9584{
9585 Unit* charm = GetCharm();
9586 if (!charm)
9587 return;
9588
9589 CharmInfo* charmInfo = charm->GetCharmInfo();
9590
9591 if (!charmInfo)
9592 {
9593 LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm ({}) has no charminfo!", charm->GetGUID().ToString());
9594 return;
9595 }
9596
9597 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 1);
9598 data << charm->GetGUID();
9599 data << uint16(0);
9600 data << uint32(0);
9601 data << uint32(0);
9602
9603 charmInfo->BuildActionBar(&data);
9604
9605 data << uint8(0); // spells count
9606 data << uint8(0); // cooldowns count
9607
9608 GetSession()->SendPacket(&data);
9609}
Unit * GetCharm() const
Definition Unit.cpp:10757

References CharmInfo::BuildActionBar(), Unit::GetCharm(), Unit::GetCharmInfo(), Object::GetGUID(), GetSession(), LOG_ERROR, MAX_UNIT_ACTION_BAR_INDEX, WorldSession::SendPacket(), SMSG_PET_SPELLS, and ObjectGuid::ToString().

Referenced by Unit::SetCharmedBy().

◆ PrepareCharmAISpells()

void Player::PrepareCharmAISpells ( )
15381{
15382 for (int i = 0; i < NUM_CAI_SPELLS; ++i)
15383 m_charmAISpells[i] = 0;
15384
15385 uint32 damage_type[4] = {0, 0, 0, 0};
15386 uint32 periodic_damage = 0;
15387
15388 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
15389 {
15390 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->Active || !itr->second->IsInSpec(GetActiveSpec()))
15391 continue;
15392
15393 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
15394 if (!spellInfo)
15395 continue;
15396
15397 if (!spellInfo->SpellFamilyName || spellInfo->IsPassive() || spellInfo->NeedsComboPoints() || (spellInfo->Stances && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED)))
15398 continue;
15399
15400 float cast = spellInfo->CalcCastTime() / 1000.0f;
15401 if (cast > 3.0f)
15402 continue;
15403
15404 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
15405 {
15406 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
15407 {
15408 int32 dmg = CalculateSpellDamage(this, spellInfo, i);
15409 uint8 offset = 0;
15410 if (cast)
15411 {
15412 dmg = dmg / cast;
15413 offset = 2;
15414 }
15415
15416 if ((int32)damage_type[offset] < dmg)
15417 {
15418 if (!m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] || !spellInfo->IsHighRankOf(sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE + offset])) || urand(0, 1))
15419 if (damage_type[1 + offset] < damage_type[offset])
15420 {
15422 damage_type[1 + offset] = damage_type[offset];
15423 }
15424
15425 m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] = spellInfo->Id;
15426 damage_type[offset] = dmg;
15427 }
15428 else if ((int32)damage_type[1 + offset] < dmg)
15429 {
15430 if (m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] && sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE + offset])->IsHighRankOf(spellInfo) && urand(0, 1))
15431 continue;
15432
15433 m_charmAISpells[SPELL_INSTANT_DAMAGE2 + offset] = spellInfo->Id;
15434 damage_type[1 + offset] = dmg;
15435 }
15436 break;
15437 }
15439 {
15440 m_charmAISpells[SPELL_T_CHARGE] = spellInfo->Id;
15441 break;
15442 }
15443 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_SPEED)
15444 {
15445 m_charmAISpells[SPELL_FAST_RUN] = spellInfo->Id;
15446 break;
15447 }
15448 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
15449 {
15450 m_charmAISpells[SPELL_IMMUNITY] = spellInfo->Id;
15451 break;
15452 }
15453 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE)
15454 {
15455 if ((int32)periodic_damage < CalculateSpellDamage(this, spellInfo, i))
15456 {
15457 m_charmAISpells[SPELL_DOT_DAMAGE] = spellInfo->Id;
15458 break;
15459 }
15460 }
15461 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_STUN)
15462 {
15463 m_charmAISpells[SPELL_T_STUN] = spellInfo->Id;
15464 break;
15465 }
15466 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_ROOT || spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_FEAR)
15467 {
15469 break;
15470 }
15471 }
15472 }
15473}
@ SPELL_ROOT_OR_FEAR
Definition Player.h:923
@ SPELL_INSTANT_DAMAGE2
Definition Player.h:925
@ SPELL_INSTANT_DAMAGE
Definition Player.h:924
@ SPELL_T_CHARGE
Definition Player.h:929
@ SPELL_DOT_DAMAGE
Definition Player.h:928
@ SPELL_FAST_RUN
Definition Player.h:931
@ SPELL_T_STUN
Definition Player.h:922
@ SPELL_IMMUNITY
Definition Player.h:930
@ SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT
Definition SharedDefines.h:659
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:780
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition SpellAuraDefines.h:94
@ SPELL_AURA_MOD_FEAR
Definition SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition SpellAuraDefines.h:89
@ SPELL_AURA_MOD_STUN
Definition SpellAuraDefines.h:75
bool IsHighRankOf(SpellInfo const *spellInfo) const
Definition SpellInfo.cpp:2597
bool NeedsComboPoints() const
Definition SpellInfo.cpp:1266
uint32 CalcCastTime(Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2364
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:14943

References SpellInfo::CalcCastTime(), Unit::CalculateSpellDamage(), SpellInfo::Effects, GetActiveSpec(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsHighRankOf(), SpellInfo::IsPassive(), m_charmAISpells, m_spells, MAX_SPELL_EFFECTS, SpellInfo::NeedsComboPoints(), NUM_CAI_SPELLS, PLAYERSPELL_REMOVED, SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED, SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_SCHOOL_IMMUNITY, SPELL_DOT_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_FAST_RUN, SPELL_IMMUNITY, SPELL_INSTANT_DAMAGE, SPELL_INSTANT_DAMAGE2, SPELL_ROOT_OR_FEAR, SPELL_T_CHARGE, SPELL_T_STUN, SpellInfo::SpellFamilyName, sSpellMgr, SpellInfo::Stances, and urand().

Referenced by LoadFromDB().

◆ PrepareGossipMenu()

void Player::PrepareGossipMenu ( WorldObject source,
uint32  menuId = 0,
bool  showQuests = false 
)

Find localizations from database.

Find localizations from database.

33{
35 menu->ClearMenus();
36
37 menu->GetGossipMenu().SetMenuId(menuId);
38
39 GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
40
41 // if default menuId and no menu options exist for this, use options from default options
42 if (menuItemBounds.first == menuItemBounds.second && menuId == GetDefaultGossipMenuForSource(source))
43 menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
44
45 uint32 npcflags = 0;
46
47 if (source->IsCreature())
48 {
49 npcflags = source->ToUnit()->GetNpcFlags();
50 if (showQuests && npcflags & UNIT_NPC_FLAG_QUESTGIVER)
51 PrepareQuestMenu(source->GetGUID());
52 }
53 else if (source->IsGameObject())
54 if (showQuests && source->ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
55 PrepareQuestMenu(source->GetGUID());
56
57 for (GossipMenuItemsContainer::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
58 {
59 bool canTalk = true;
60 if (!sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
61 continue;
62
63 if (Creature* creature = source->ToCreature())
64 {
65 if (!(itr->second.OptionNpcFlag & npcflags))
66 continue;
67
68 switch (itr->second.OptionType)
69 {
71 canTalk = false; // added in special mode
72 break;
74 if (!isDead())
75 canTalk = false;
76 break;
78 {
79 if (!creature->isVendorWithIconSpeak())
80 {
81 VendorItemData const* vendorItems = itr->second.ActionMenuID ? sObjectMgr->GetNpcVendorItemList(itr->second.ActionMenuID) : creature->GetVendorItems();
82 if (!vendorItems || vendorItems->Empty())
83 {
84 LOG_ERROR("sql.sql", "Creature {} have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUID().ToString());
85 canTalk = false;
86 }
87 break;
88 }
89 break;
90 }
93 if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(GetLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
94 canTalk = false;
95 break;
97 if (!creature->isCanTrainingAndResetTalentsOf(this))
98 canTalk = false;
99 break;
101 if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureTemplate()->trainer_class != CLASS_HUNTER)
102 canTalk = false;
103 break;
105 if (GetSession()->SendLearnNewTaxiNode(creature))
106 return;
107 break;
109 if (!creature->isCanInteractWithBattleMaster(this, false))
110 canTalk = false;
111 break;
114 canTalk = false;
115 break;
117 canTalk = false;
118 break;
120 if (!creature->IsValidTrainerForPlayer(this))
121 {
122 canTalk = false;
123 }
124 break;
126 if (creature->isVendorWithIconSpeak())
127 {
128 VendorItemData const* vendorItems = creature->GetVendorItems();
129 if (!vendorItems || vendorItems->Empty())
130 {
131 canTalk = false;
132 }
133 }
134 break;
141 break; // no checks
143 if (!sOutdoorPvPMgr->CanTalkTo(this, creature, itr->second))
144 canTalk = false;
145 break;
146 default:
147 LOG_ERROR("sql.sql", "Creature entry {} has unknown OptionType {} for menu {}", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID);
148 canTalk = false;
149 break;
150 }
151 }
152 else if (GameObject* go = source->ToGameObject())
153 {
154 switch (itr->second.OptionType)
155 {
157 if (go->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && go->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
158 canTalk = false;
159 break;
160 default:
161 canTalk = false;
162 break;
163 }
164 }
165
166 if (canTalk)
167 {
168 // using gossip_menu_option texts by default
169 std::string strOptionText = itr->second.OptionText;
170 std::string strBoxText = itr->second.BoxText;
171 // search in broadcast_text and broadcast_text_locale
172 BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
173 BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
175
176 if (optionBroadcastText)
177 ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
178
179 if (boxBroadcastText)
180 ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
181
182 // if the language is not default and the texts weren't found, maybe they're in gossip_menu_option_locale table
183 if (locale != DEFAULT_LOCALE)
184 {
185 if (!optionBroadcastText)
186 {
188 if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
189 ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
190 }
191
192 if (!boxBroadcastText)
193 {
195 if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
196 ObjectMgr::GetLocaleString(gossipMenuLocale->BoxText, locale, strBoxText);
197 }
198 }
199
200 menu->GetGossipMenu().AddMenuItem(itr->second.OptionID, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
201 menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionID, itr->second.ActionMenuID, itr->second.ActionPoiID);
202 }
203 }
204
205 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && npcflags & UNIT_NPC_FLAG_FLIGHTMASTER)
207}
LocaleConstant
Definition Common.h:117
#define DEFAULT_LOCALE
Definition Common.h:131
@ GOSSIP_ICON_INTERACT_1
Definition GossipDef.h:65
@ LANG_TOGGLE_INSTANT_FLIGHT
Definition Language.h:1326
std::pair< GossipMenuItemsContainer::const_iterator, GossipMenuItemsContainer::const_iterator > GossipMenuItemsMapBounds
Definition ObjectMgr.h:634
@ HUNTER_PET
Definition PetDefines.h:32
@ GAMEOBJECT_TYPE_GOOBER
Definition SharedDefines.h:1570
@ TRAINER_TYPE_PETS
Definition SharedDefines.h:2620
GameobjectTypes GetGoType() const
Definition GameObject.h:202
void SetMenuId(uint32 menu_id)
Definition GossipDef.h:171
void AddMenuItem(int32 menuItemId, uint8 icon, std::string const &message, uint32 sender, uint32 action, std::string const &boxMessage, uint32 boxMoney, bool coded=false)
Definition GossipDef.cpp:41
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi)
Definition GossipDef.cpp:136
static std::string_view GetLocaleString(std::vector< std::string > const &data, std::size_t locale)
Definition ObjectMgr.h:1419
void ClearMenus()
Definition GossipDef.cpp:187
AC_GAME_API std::string GetAcoreString(ChatHandler const *handler, AcoreStrings which)
Definition ChatCommandHelpers.cpp:27
Definition ObjectMgr.h:434
std::vector< std::string > MaleText
Definition ObjectMgr.h:443
Definition CreatureData.h:349

References GossipMenu::AddGossipMenuItemData(), GossipMenu::AddMenuItem(), CLASS_CONTEXT_PET, CLASS_HUNTER, PlayerMenu::ClearMenus(), CONFIG_INSTANT_TAXI, CONFIG_MIN_DUALSPEC_LEVEL, DEFAULT_LOCALE, VendorItemData::Empty(), BroadcastText::FemaleText, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_QUESTGIVER, GENDER_MALE, WorldSession::GetAcoreString(), Creature::GetCreatureTemplate(), GetDefaultGossipMenuForSource(), Unit::getGender(), PlayerMenu::GetGossipMenu(), GameObject::GetGoType(), Object::GetGUID(), Unit::GetLevel(), ObjectMgr::GetLocaleString(), Unit::GetNpcFlags(), GetPet(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), GetSpecsCount(), GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT, GOSSIP_ICON_INTERACT_1, GOSSIP_OPTION_ARMORER, GOSSIP_OPTION_AUCTIONEER, GOSSIP_OPTION_BANKER, GOSSIP_OPTION_BATTLEFIELD, GOSSIP_OPTION_DUALSPEC_INFO, GOSSIP_OPTION_GOSSIP, GOSSIP_OPTION_INNKEEPER, GOSSIP_OPTION_LEARNDUALSPEC, GOSSIP_OPTION_OUTDOORPVP, GOSSIP_OPTION_PETITIONER, GOSSIP_OPTION_QUESTGIVER, GOSSIP_OPTION_SPIRITGUIDE, GOSSIP_OPTION_SPIRITHEALER, GOSSIP_OPTION_STABLEPET, GOSSIP_OPTION_TABARDDESIGNER, GOSSIP_OPTION_TAXIVENDOR, GOSSIP_OPTION_TRAINER, GOSSIP_OPTION_UNLEARNPETTALENTS, GOSSIP_OPTION_UNLEARNTALENTS, GOSSIP_OPTION_VENDOR, HUNTER_PET, IsClass(), Object::IsCreature(), Unit::isDead(), Object::IsGameObject(), LANG_TOGGLE_INSTANT_FLIGHT, LOG_ERROR, m_spells, MAKE_PAIR32(), BroadcastText::MaleText, PlayerTalkClass, PrepareQuestMenu(), sConditionMgr, GossipMenu::SetMenuId(), sObjectMgr, sOutdoorPvPMgr, sWorld, Object::ToCreature(), Object::ToGameObject(), Object::ToUnit(), CreatureTemplate::trainer_type, TRAINER_TYPE_PETS, UNIT_NPC_FLAG_FLIGHTMASTER, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), npc_thrall_old_hillsbrad::OnGossipHello(), brann_bronzebeard::OnGossipHello(), go_apexis_relic::OnGossipHello(), OnGossipSelect(), Spell::SendLoot(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and GameObject::Use().

◆ PrepareQuestMenu()

void Player::PrepareQuestMenu ( ObjectGuid  guid)
40{
41 QuestRelationBounds objectQR;
42 QuestRelationBounds objectQIR;
43
44 // pets also can have quests
46 if (creature)
47 {
48 objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
49 objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
50 }
51 else
52 {
53 //we should obtain map pointer from GetMap() in 99% of cases. Special case
54 //only for quests which cast teleport spells on player
56 ASSERT(_map);
57 GameObject* pGameObject = _map->GetGameObject(guid);
58 if (pGameObject)
59 {
60 objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
61 objectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry());
62 }
63 else
64 return;
65 }
66
68 qm.ClearMenu();
69
70 for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
71 {
72 uint32 quest_id = i->second;
73 QuestStatus status = GetQuestStatus(quest_id);
74 if (status == QUEST_STATUS_COMPLETE)
75 qm.AddMenuItem(quest_id, 4);
76 else if (status == QUEST_STATUS_INCOMPLETE)
77 qm.AddMenuItem(quest_id, 4);
78 //else if (status == QUEST_STATUS_AVAILABLE)
79 // qm.AddMenuItem(quest_id, 2);
80 }
81
82 for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
83 {
84 uint32 quest_id = i->second;
85 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
86 if (!quest)
87 continue;
88
89 if (!CanTakeQuest(quest, false))
90 continue;
91
92 if (quest->IsAutoComplete() && (!quest->IsRepeatable() || quest->IsDaily() || quest->IsWeekly() || quest->IsMonthly()))
93 qm.AddMenuItem(quest_id, 0);
94 else if (quest->IsAutoComplete())
95 qm.AddMenuItem(quest_id, 4);
96 else if (GetQuestStatus(quest_id) == QUEST_STATUS_NONE)
97 qm.AddMenuItem(quest_id, 2);
98 }
99}
QuestMenu & GetQuestMenu()
Definition GossipDef.h:265
Definition GossipDef.h:229
void ClearMenu()
Definition GossipDef.cpp:310
void AddMenuItem(uint32 QuestId, uint8 Icon)
Definition GossipDef.cpp:286

References QuestMenu::AddMenuItem(), ASSERT, CanTakeQuest(), QuestMenu::ClearMenu(), ObjectAccessor::GetCreatureOrPetOrVehicle(), Object::GetEntry(), Map::GetGameObject(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), PlayerMenu::GetQuestMenu(), GetQuestStatus(), Quest::IsAutoComplete(), Quest::IsDaily(), Object::IsInWorld(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), PlayerTalkClass, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, sMapMgr, and sObjectMgr.

Referenced by npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), npc_sayge::OnGossipHello(), go_fel_crystalforge::OnGossipHello(), go_bashir_crystalforge::OnGossipHello(), OnGossipSelect(), PrepareGossipMenu(), and npc_maredis_firestar::npc_maredis_firestarAI::sGossipSelect().

◆ PrettyPrintRequirementsAchievementsList()

void Player::PrettyPrintRequirementsAchievementsList ( const std::vector< const ProgressionRequirement * > &  missingAchievements) const
6650{
6652 for (const ProgressionRequirement* missingReq : missingAchievements)
6653 {
6654 AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(missingReq->id);
6655 if (!achievementEntry)
6656 {
6657 continue;
6658 }
6659
6660 std::string name = achievementEntry->name[sObjectMgr->GetDBCLocaleIndex()];
6661
6662 std::stringstream stream;
6663 stream << "|cffff7c0a|Hachievement:";
6664 stream << missingReq->id;
6665 stream << ":";
6666 stream << GetGUID().ToString();
6667 stream << ":0:0:0:0:0:0:0:0|h[";
6668 stream << name;
6669 stream << "]|h|r";
6670
6671 if (missingReq->note.empty())
6672 {
6673 ChatHandler(GetSession()).PSendSysMessage(" - {}", stream.str());
6674 }
6675 else
6676 {
6677 ChatHandler(GetSession()).PSendSysMessage(" - {} {} {}", stream.str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note);
6678 }
6679 }
6680}
DBCStorage< AchievementEntry > sAchievementStore(Achievementfmt)
@ LANG_ACCESS_REQUIREMENT_NOTE
Definition Language.h:851
Definition DBCStructure.h:40
std::array< char const *, 16 > name
Definition DBCStructure.h:45
Definition Player.h:940

References Object::GetGUID(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), LANG_ACCESS_REQUIREMENT_NOTE, AchievementEntry::name, ChatHandler::PSendSysMessage(), sAchievementStore, sObjectMgr, and ObjectGuid::ToString().

Referenced by Satisfy().

◆ PrettyPrintRequirementsItemsList()

void Player::PrettyPrintRequirementsItemsList ( const std::vector< const ProgressionRequirement * > &  missingItems) const
6683{
6685 for (const ProgressionRequirement* missingReq : missingItems)
6686 {
6687 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(missingReq->id);
6688 if (!itemTemplate)
6689 {
6690 continue;
6691 }
6692
6693 //Get the localised name
6694 std::string name = itemTemplate->Name1;
6695 if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplate->ItemId))
6696 {
6697 ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
6698 }
6699
6700 std::stringstream stream;
6701 stream << "|c";
6702 stream << std::hex << ItemQualityColors[itemTemplate->Quality] << std::dec;
6703 stream << "|Hitem:";
6704 stream << itemTemplate->ItemId;
6705 stream << ":0:0:0:0:0:0:0:0:0|h[";
6706 stream << name;
6707 stream << "]|h|r";
6708
6709 if (missingReq->note.empty())
6710 {
6711 ChatHandler(GetSession()).PSendSysMessage(" - {}", stream.str());
6712 }
6713 else
6714 {
6715 ChatHandler(GetSession()).PSendSysMessage(" - {} {} {}", stream.str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note);
6716 }
6717 }
6718}
const uint32 ItemQualityColors[MAX_ITEM_QUALITY]
Definition SharedDefines.h:353
Definition ItemTemplate.h:837
std::string Name1
Definition ItemTemplate.h:624

References ObjectMgr::GetLocaleString(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), ItemTemplate::ItemId, ItemQualityColors, LANG_ACCESS_REQUIREMENT_NOTE, ItemTemplate::Name1, ChatHandler::PSendSysMessage(), ItemTemplate::Quality, and sObjectMgr.

Referenced by Satisfy().

◆ PrettyPrintRequirementsQuestList()

void Player::PrettyPrintRequirementsQuestList ( const std::vector< const ProgressionRequirement * > &  missingQuests) const
6613{
6615 for (const ProgressionRequirement* missingReq : missingQuests)
6616 {
6617 Quest const* questTemplate = sObjectMgr->GetQuestTemplate(missingReq->id);
6618 if (!questTemplate)
6619 {
6620 continue;
6621 }
6622
6623 std::string questTitle = questTemplate->GetTitle();
6624 if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplate->GetQuestId()))
6625 {
6626 ObjectMgr::GetLocaleString(questLocale->Title, loc_idx, questTitle);
6627 }
6628
6629 std::stringstream stream;
6630 stream << "|cffff7c0a|Hquest:";
6631 stream << questTemplate->GetQuestId();
6632 stream << ":";
6633 stream << questTemplate->GetQuestLevel();
6634 stream << "|h[";
6635 stream << questTitle;
6636 stream << "]|h|r";
6637
6638 if (missingReq->note.empty())
6639 {
6640 ChatHandler(GetSession()).PSendSysMessage(" - {}", stream.str());
6641 }
6642 else
6643 {
6644 ChatHandler(GetSession()).PSendSysMessage(" - {} {} {}", stream.str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note);
6645 }
6646 }
6647}
int32 GetQuestLevel() const
Definition QuestDef.h:233
std::string const & GetTitle() const
Definition QuestDef.h:261
Definition QuestDef.h:183

References ObjectMgr::GetLocaleString(), Quest::GetQuestId(), Quest::GetQuestLevel(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Quest::GetTitle(), LANG_ACCESS_REQUIREMENT_NOTE, ChatHandler::PSendSysMessage(), and sObjectMgr.

Referenced by Satisfy().

◆ ProcessDelayedOperations()

void Player::ProcessDelayedOperations ( )
1630{
1631 if (m_DelayedOperations == 0)
1632 return;
1633
1635 {
1636 ResurrectPlayer(0.0f, false);
1637
1640 else
1641 SetFullHealth();
1642
1645 else
1647
1648 SetPower(POWER_RAGE, 0);
1650
1652 }
1653
1655 SaveToDB(false, false);
1656
1658 {
1659 Aura* aura = GetAura(26013);
1660 if (!aura || aura->GetDuration() <= 900000)
1661 CastSpell(this, 26013, true);
1662 }
1663
1665 {
1667 {
1668 // xinef: remove shapeshift auras
1670 {
1672 }
1675 }
1676 }
1677
1679 {
1681 {
1686 }
1687 }
1688
1690 {
1691 if (Group* g = GetGroup())
1692 g->SendUpdateToPlayer(GetGUID());
1693 }
1694
1696 {
1697 if (Vehicle* vehicle = GetVehicle())
1698 {
1699 SeatMap::iterator itr = vehicle->GetSeatIteratorForPassenger(this);
1700 if (itr != vehicle->Seats.end())
1701 if (Unit* base = vehicle->GetBase())
1702 {
1703 ExitVehicle();
1704 base->HandleSpellClick(this, itr->first);
1705 }
1706 }
1707 }
1708
1709 //we have executed ALL delayed ops, so clear the flag
1711}
@ DELAYED_BG_GROUP_RESTORE
Flag to restore group state after teleport from BG.
Definition Player.h:915
@ DELAYED_SAVE_PLAYER
Definition Player.h:910
@ DELAYED_BG_MOUNT_RESTORE
Flag to restore mount state after teleport from BG.
Definition Player.h:913
@ DELAYED_VEHICLE_TELEPORT
Definition Player.h:916
@ DELAYED_BG_TAXI_RESTORE
Flag to restore taxi state after teleport from BG.
Definition Player.h:914
@ DELAYED_SPELL_CAST_DESERTER
Definition Player.h:912
@ DELAYED_RESURRECT_PLAYER
Definition Player.h:911
void SaveToDB(bool create, bool logout)
Definition PlayerStorage.cpp:7064
uint32 m_resurrectMana
Definition Player.h:2862
void ContinueTaxiFlight()
Definition Player.cpp:10433
uint32 m_resurrectHealth
Definition Player.h:2862
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:18951
Definition Vehicle.h:28

References Unit::AddAura(), PlayerTaxi::AddTaxiDestination(), Unit::CastSpell(), EntryPointData::ClearTaxiPath(), ContinueTaxiFlight(), DELAYED_BG_GROUP_RESTORE, DELAYED_BG_MOUNT_RESTORE, DELAYED_BG_TAXI_RESTORE, DELAYED_RESURRECT_PLAYER, DELAYED_SAVE_PLAYER, DELAYED_SPELL_CAST_DESERTER, DELAYED_VEHICLE_TELEPORT, Unit::ExitVehicle(), Unit::GetAura(), Aura::GetDuration(), GetGroup(), Object::GetGUID(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetVehicle(), EntryPointData::HasTaxiPath(), Unit::IsInDisallowedMountForm(), m_DelayedOperations, m_entryPointData, m_resurrectHealth, m_resurrectMana, m_taxi, EntryPointData::mountSpell, POWER_ENERGY, POWER_MANA, POWER_RAGE, Unit::RemoveAurasByType(), ResurrectPlayer(), SaveToDB(), Unit::SetFullHealth(), Unit::SetHealth(), Unit::SetPower(), SpawnCorpseBones(), SPELL_AURA_MOD_SHAPESHIFT, and EntryPointData::taxiPath.

Referenced by WorldSession::HandleMoveTeleportAck(), and WorldSession::HandleMoveWorldportAck().

◆ ProcessSpellQueue()

void Player::ProcessSpellQueue ( )
protected
2379{
2380 while (!SpellQueue.empty())
2381 {
2382 PendingSpellCastRequest& request = SpellQueue.front(); // Peek at the first spell
2383 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(request.spellId);
2384 if (!spellInfo)
2385 {
2386 LOG_ERROR("entities.player", "Player::ProcessSpellQueue: Invalid spell {}", request.spellId);
2387 SpellQueue.clear();
2388 break;
2389 }
2390 if (CanExecutePendingSpellCastRequest(spellInfo))
2391 {
2393
2394 // ExecuteOrCancelSpellCastRequest() can lead to clearing the SpellQueue.
2395 // Example scenario:
2396 // Handling a spell → Dealing damage to yourself (e.g., spell_pri_vampiric_touch) →
2397 // Killing yourself → Player::setDeathState() → SpellQueue.clear().
2398 // Calling std::deque::pop_front() on an empty deque results in undefined behavior,
2399 // so an additional check is added.
2400 if (!SpellQueue.empty())
2401 SpellQueue.pop_front();
2402 }
2403 else // If the first spell can't execute, stop processing
2404 break;
2405 }
2406}
bool CanExecutePendingSpellCastRequest(SpellInfo const *spellInfo)
Definition PlayerUpdates.cpp:2313
void ExecuteOrCancelSpellCastRequest(PendingSpellCastRequest *castRequest, bool isCancel=false)
Definition PlayerUpdates.cpp:2364
uint32 spellId
Definition Player.h:1072

References CanExecutePendingSpellCastRequest(), ExecuteOrCancelSpellCastRequest(), LOG_ERROR, PendingSpellCastRequest::spellId, SpellQueue, and sSpellMgr.

Referenced by Update().

◆ ProcessTerrainStatusUpdate()

void Player::ProcessTerrainStatusUpdate ( )
overridevirtual

Reimplemented from Unit.

2254{
2255 // process liquid auras using generic unit code
2257
2258 LiquidData const& liquidData = GetLiquidData();
2259
2260 // player specific logic for mirror timers
2261 if (liquidData.Status != LIQUID_MAP_NO_WATER)
2262 {
2263 // Breath bar state (under water in any liquid type)
2264 if ((liquidData.Flags & MAP_ALL_LIQUIDS) != 0)
2265 {
2266 if ((liquidData.Status & LIQUID_MAP_UNDER_WATER) != 0)
2268 else
2269 m_MirrorTimerFlags &= ~UNDERWATER_INWATER;
2270 }
2271
2272 // Fatigue bar state (if not on flight path or transport)
2273 if ((liquidData.Flags & MAP_LIQUID_TYPE_DARK_WATER) && !IsInFlight() && !GetTransport())
2274 {
2275 // Exclude also uncontrollable vehicles
2276 Vehicle* vehicle = GetVehicle();
2277 VehicleSeatEntry const* vehicleSeat = vehicle ? vehicle->GetSeatForPassenger(this) : nullptr;
2278 if (!vehicleSeat || vehicleSeat->CanControl())
2280 else
2281 m_MirrorTimerFlags &= ~UNDERWATER_INDARKWATER;
2282 }
2283 else
2284 m_MirrorTimerFlags &= ~UNDERWATER_INDARKWATER;
2285
2286 // Lava state (any contact)
2287 if (liquidData.Flags & MAP_LIQUID_TYPE_MAGMA)
2288 {
2289 if (liquidData.Status & MAP_LIQUID_STATUS_IN_CONTACT)
2291 else
2292 m_MirrorTimerFlags &= ~UNDERWATER_INLAVA;
2293 }
2294
2295 // Slime state (any contact)
2296 if (liquidData.Flags & MAP_LIQUID_TYPE_SLIME)
2297 {
2298 if (liquidData.Status & MAP_LIQUID_STATUS_IN_CONTACT)
2300 else
2301 m_MirrorTimerFlags &= ~UNDERWATER_INSLIME;
2302 }
2303 }
2304 else
2306}
#define MAP_LIQUID_TYPE_MAGMA
Definition GridTerrainData.h:37
@ LIQUID_MAP_UNDER_WATER
Definition GridTerrainData.h:195
@ LIQUID_MAP_NO_WATER
Definition GridTerrainData.h:191
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition GridTerrainData.h:32
#define MAP_LIQUID_TYPE_DARK_WATER
Definition GridTerrainData.h:42
#define MAP_LIQUID_TYPE_SLIME
Definition GridTerrainData.h:38
#define MAP_ALL_LIQUIDS
Definition GridTerrainData.h:40
@ UNDERWATER_INSLIME
Definition Player.h:103
virtual void ProcessTerrainStatusUpdate()
Definition Unit.cpp:4316
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger)
Definition Vehicle.cpp:598
LiquidData const & GetLiquidData() const
Definition Object.cpp:3054
Definition GridTerrainData.h:199
uint32 Flags
Definition GridTerrainData.h:203
LiquidStatus Status
Definition GridTerrainData.h:206
Definition DBCStructure.h:2065
bool CanControl() const
Definition DBCStructure.h:2128

References VehicleSeatEntry::CanControl(), LiquidData::Flags, WorldObject::GetLiquidData(), Vehicle::GetSeatForPassenger(), WorldObject::GetTransport(), Unit::GetVehicle(), Unit::IsInFlight(), LIQUID_MAP_NO_WATER, LIQUID_MAP_UNDER_WATER, m_MirrorTimerFlags, MAP_ALL_LIQUIDS, MAP_LIQUID_STATUS_IN_CONTACT, MAP_LIQUID_TYPE_DARK_WATER, MAP_LIQUID_TYPE_MAGMA, MAP_LIQUID_TYPE_SLIME, Unit::ProcessTerrainStatusUpdate(), LiquidData::Status, UNDERWATER_INDARKWATER, UNDERWATER_INLAVA, UNDERWATER_INSLIME, and UNDERWATER_INWATER.

◆ ProhibitSpellSchool()

void Player::ProhibitSpellSchool ( SpellSchoolMask  idSchoolMask,
uint32  unTimeMs 
)
overridevirtual

Reimplemented from Unit.

10518{
10519 PacketCooldowns cooldowns;
10520 WorldPacket data;
10521
10522 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
10523 {
10524 if (itr->second->State == PLAYERSPELL_REMOVED)
10525 continue;
10526 uint32 unSpellId = itr->first;
10527 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(unSpellId);
10528
10529 // Not send cooldown for this spells
10530 if (spellInfo->IsCooldownStartedOnEvent())
10531 continue;
10532
10534 continue;
10535
10536 if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
10537 {
10538 cooldowns[unSpellId] = unTimeMs;
10539 AddSpellCooldown(unSpellId, 0, unTimeMs, true);
10540 }
10541 }
10542
10543 if (!cooldowns.empty())
10544 {
10546 GetSession()->SendPacket(&data);
10547 }
10548}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1554
uint32 PreventionType
Definition SpellInfo.h:390
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1212
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1998

References AddSpellCooldown(), Unit::BuildCooldownPacket(), SpellInfo::GetSchoolMask(), GetSession(), GetSpellCooldownDelay(), SpellInfo::IsCooldownStartedOnEvent(), m_spells, PLAYERSPELL_REMOVED, SpellInfo::PreventionType, WorldSession::SendPacket(), SPELL_COOLDOWN_FLAG_NONE, SPELL_PREVENTION_TYPE_SILENCE, and sSpellMgr.

◆ QuickEquipItem()

void Player::QuickEquipItem ( uint16  pos,
Item pItem 
)
2836{
2837 if (pItem)
2838 {
2840 AddItemDurations(pItem);
2841
2842 uint8 slot = pos & 255;
2843 VisualizeItem(slot, pItem);
2844
2845 if (IsInWorld())
2846 {
2847 pItem->AddToWorld();
2848 pItem->SendUpdateToPlayer(this);
2849 }
2850
2853
2854 sScriptMgr->OnPlayerEquip(this, pItem, (pos >> 8), slot, true);
2855 }
2856}

References ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, AddEnchantmentDurations(), AddItemDurations(), Object::AddToWorld(), Object::GetEntry(), Object::IsInWorld(), Object::SendUpdateToPlayer(), sScriptMgr, UpdateAchievementCriteria(), and VisualizeItem().

Referenced by _LoadInventory().

◆ RecalculateRating()

void Player::RecalculateRating ( CombatRating  cr)
inline
1977{ ApplyRatingMod(cr, 0, true);}

References ApplyRatingMod().

Referenced by DestroyItem(), EquipItem(), RemoveItem(), and UpdateAllStats().

◆ RefundItem()

void Player::RefundItem ( Item item)
private

Already checked before

15559{
15560 if (!item->IsRefundable())
15561 {
15562 LOG_DEBUG("entities.player.items", "Item refund: item not refundable!");
15563 return;
15564 }
15565
15566 if (item->IsRefundExpired()) // item refund has expired
15567 {
15568 item->SetNotRefundable(this);
15570 data << item->GetGUID(); // Guid
15571 data << uint32(10); // Error!
15572 GetSession()->SendPacket(&data);
15573 return;
15574 }
15575
15576 if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded
15577 {
15578 LOG_DEBUG("entities.player.items", "Item refund: item was traded!");
15579 item->SetNotRefundable(this);
15580 return;
15581 }
15582
15583 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost());
15584 if (!iece)
15585 {
15586 LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data.");
15587 return;
15588 }
15589
15590 bool store_error = false;
15591 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
15592 {
15593 uint32 count = iece->reqitemcount[i];
15594 uint32 itemid = iece->reqitem[i];
15595
15596 if (count && itemid)
15597 {
15598 ItemPosCountVec dest;
15599 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
15600 if (msg != EQUIP_ERR_OK)
15601 {
15602 store_error = true;
15603 break;
15604 }
15605 }
15606 }
15607
15608 if (store_error)
15609 {
15611 data << item->GetGUID(); // Guid
15612 data << uint32(10); // Error!
15613 GetSession()->SendPacket(&data);
15614 return;
15615 }
15616
15617 WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
15618 data << item->GetGUID(); // item guid
15619 data << uint32(0); // 0, or error code
15620 data << uint32(item->GetPaidMoney()); // money cost
15621 data << uint32(iece->reqhonorpoints); // honor point cost
15622 data << uint32(iece->reqarenapoints); // arena point cost
15623 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
15624 {
15625 data << uint32(iece->reqitem[i]);
15626 data << uint32(iece->reqitemcount[i]);
15627 }
15628 GetSession()->SendPacket(&data);
15629
15630 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
15631
15632 // Save all relevant data to DB to prevent desynchronisation exploits
15633 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15634
15635 // Delete any references to the refund data
15636 item->SetNotRefundable(this, true, &trans);
15637
15638 // Destroy item
15639 DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
15640
15641 // Grant back extendedcost items
15642 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
15643 {
15644 uint32 count = iece->reqitemcount[i];
15645 uint32 itemid = iece->reqitem[i];
15646 if (count && itemid)
15647 {
15648 ItemPosCountVec dest;
15649 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
15650 ASSERT(msg == EQUIP_ERR_OK);
15651 Item* it = StoreNewItem(dest, itemid, true);
15652 SendNewItem(it, count, true, false, true);
15653 }
15654 }
15655
15656 // Grant back money
15657 if (moneyRefund)
15658 ModifyMoney(moneyRefund); // Saved in SaveInventoryAndGoldToDB
15659
15660 // Grant back Honor points
15661 if (uint32 honorRefund = iece->reqhonorpoints)
15662 ModifyHonorPoints(honorRefund, trans);
15663
15664 // Grant back Arena points
15665 if (uint32 arenaRefund = iece->reqarenapoints)
15666 ModifyArenaPoints(arenaRefund, trans);
15667
15669
15670 CharacterDatabase.CommitTransaction(trans);
15671}
uint32 GetPaidExtendedCost()
Definition Item.h:349
uint32 GetPaidMoney()
Definition Item.h:348
ObjectGuid::LowType GetRefundRecipient()
Definition Item.h:347
bool IsRefundExpired()
Definition Item.cpp:1253
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7135
@ SMSG_ITEM_REFUND_RESULT
Definition Opcodes.h:1235

References ASSERT, CanStoreNewItem(), CharacterDatabase, DestroyItem(), EQUIP_ERR_OK, Item::GetBagSlot(), Object::GetGUID(), Object::GetGUID(), Item::GetPaidExtendedCost(), Item::GetPaidMoney(), Item::GetRefundRecipient(), GetSession(), Item::GetSlot(), Item::IsRefundable(), Item::IsRefundExpired(), LOG_DEBUG, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, ModifyArenaPoints(), ModifyHonorPoints(), ModifyMoney(), NULL_BAG, NULL_SLOT, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, SaveInventoryAndGoldToDB(), SendNewItem(), WorldSession::SendPacket(), Item::SetNotRefundable(), sItemExtendedCostStore, SMSG_ITEM_REFUND_RESULT, and StoreNewItem().

Referenced by WorldSession::HandleItemRefund().

◆ Regenerate()

void Player::Regenerate ( Powers  power)
Todo:
: possible use of miscvalueb instead of amount
1852{
1853 uint32 maxValue = GetMaxPower(power);
1854 if (!maxValue)
1855 return;
1856
1857 //If .cheat power is on always have the max power
1859 {
1860 if (m_regenTimerCount >= 2000)
1861 {
1862 //Set the value to 0 first then set it to max to force resend of packet as for range clients keeps removing rage
1863 if (power == POWER_RAGE || power == POWER_RUNIC_POWER)
1864 {
1865 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, 0);
1866 }
1867
1868 SetPower(power, maxValue);
1869 return;
1870 }
1871 }
1872
1873 uint32 curValue = GetPower(power);
1874
1877 return;
1878
1879 float addvalue = 0.0f;
1880
1881 switch (power)
1882 {
1883 case POWER_MANA:
1884 {
1885 bool recentCast = IsUnderLastManaUseEffect();
1886 float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
1887
1888 if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
1889 ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA) * (2.066f - (GetLevel() * 0.066f));
1890
1891 if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct
1893 else
1895 }
1896 break;
1897 case POWER_RAGE: // Regenerate rage
1898 {
1899 if (!IsInCombat() && !HasInterruptRegenAura())
1900 {
1901 float RageDecreaseRate = sWorld->getRate(RATE_POWER_RAGE_LOSS);
1902 addvalue += -20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
1903 }
1904 }
1905 break;
1906 case POWER_ENERGY: // Regenerate energy (rogue)
1907 // Regen per second
1909 // Regen per millisecond
1910 addvalue *= 0.001f;
1911 // Milliseconds passed
1912 addvalue *= m_regenTimer;
1913 // Rate
1914 addvalue *= sWorld->getRate(RATE_POWER_ENERGY);
1915 break;
1916 case POWER_RUNIC_POWER:
1917 {
1918 if (!IsInCombat() && !HasInterruptRegenAura())
1919 {
1920 float RunicPowerDecreaseRate = sWorld->getRate(RATE_POWER_RUNICPOWER_LOSS);
1921 addvalue += -30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
1922 }
1923 }
1924 break;
1925 case POWER_RUNE:
1926 case POWER_FOCUS:
1927 case POWER_HAPPINESS:
1928 break;
1929 case POWER_HEALTH:
1930 return;
1931 default:
1932 break;
1933 }
1934
1935 // Mana regen calculated in Player::UpdateManaRegen(), energy regen calculated in Player::UpdateEnergyRegen()
1936 if (power != POWER_MANA && power != POWER_ENERGY)
1937 {
1939 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
1940 if (Powers((*i)->GetMiscValue()) == power)
1941 AddPct(addvalue, (*i)->GetAmount());
1942
1943 // Butchery requires combat for this effect
1944 if (power != POWER_RUNIC_POWER || IsInCombat())
1946 }
1947
1948 if (addvalue < 0.0f)
1949 {
1950 if (curValue == 0)
1951 return;
1952 }
1953 else if (addvalue > 0.0f)
1954 {
1955 if (curValue == maxValue)
1956 return;
1957 }
1958 else
1959 return;
1960
1961 addvalue += m_powerFraction[power];
1962 uint32 integerValue = uint32(std::fabs(addvalue));
1963
1964 if (addvalue < 0.0f)
1965 {
1966 if (curValue > integerValue)
1967 {
1968 curValue -= integerValue;
1969 m_powerFraction[power] = addvalue + integerValue;
1970 }
1971 else
1972 {
1973 curValue = 0;
1974 m_powerFraction[power] = 0;
1975 }
1976 }
1977 else
1978 {
1979 curValue += integerValue;
1980
1981 if (curValue >= maxValue)
1982 {
1983 curValue = maxValue;
1984 m_powerFraction[power] = 0;
1985 }
1986 else
1987 m_powerFraction[power] = addvalue - integerValue;
1988 }
1989
1990 if (m_regenTimerCount >= 2000 || curValue == 0 || curValue == maxValue)
1991 SetPower(power, curValue, true, true);
1992 else
1994}
@ CHEAT_POWER
Definition Player.h:1009
@ POWER_HEALTH
Definition SharedDefines.h:278
@ SPELL_AURA_MOD_POWER_REGEN
Definition SpellAuraDefines.h:148
@ SPELL_AURA_PREVENT_REGENERATE_POWER
Definition SpellAuraDefines.h:357
@ UNIT_FIELD_POWER1
Definition UpdateFields.h:97
@ UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER
Definition UpdateFields.h:113
@ UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER
Definition UpdateFields.h:112
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:619
@ RATE_POWER_RAGE_LOSS
Definition WorldConfig.h:385
@ RATE_POWER_RUNICPOWER_LOSS
Definition WorldConfig.h:387
@ RATE_POWER_ENERGY
Definition WorldConfig.h:389
@ RATE_POWER_MANA
Definition WorldConfig.h:383
@ CONFIG_LOW_LEVEL_REGEN_BOOST
Definition WorldConfig.h:136
void UpdateUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:652
bool IsUnderLastManaUseEffect() const
Definition Unit.cpp:17317
bool HasInterruptRegenAura() const
Definition Unit.h:1723
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
Definition Unit.cpp:5808

References AddPct(), AsUnderlyingType(), CHEAT_POWER, CONFIG_LOW_LEVEL_REGEN_BOOST, Unit::GetAuraEffectsByType(), GetCommandStatus(), Object::GetFloatValue(), Unit::GetLevel(), Unit::GetMaxPower(), Unit::GetPower(), Unit::GetTotalAuraModifierByMiscValue(), Unit::HasAuraTypeWithMiscvalue(), Unit::HasInterruptRegenAura(), IN_MILLISECONDS, Unit::IsInCombat(), Unit::IsUnderLastManaUseEffect(), m_powerFraction, Unit::m_regenTimer, m_regenTimerCount, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, RATE_POWER_ENERGY, RATE_POWER_MANA, RATE_POWER_RAGE_LOSS, RATE_POWER_RUNICPOWER_LOSS, Unit::SetPower(), SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_POWER_REGEN_PERCENT, SPELL_AURA_PREVENT_REGENERATE_POWER, sWorld, UNIT_FIELD_POWER1, UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, and Object::UpdateUInt32Value().

Referenced by RegenerateAll().

◆ RegenerateAll()

void Player::RegenerateAll ( )
1769{
1770 //if (m_regenTimer <= 500)
1771 // return;
1772
1775
1777
1779
1780 // Runes act as cooldowns, and they don't need to send any data
1782 for (uint8 i = 0; i < MAX_RUNES; ++i)
1783 {
1784 // xinef: implement grace
1785 if (int32 cd = GetRuneCooldown(i))
1786 {
1787 SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0);
1788 // start grace counter, player must be in combat and rune has to go off cooldown
1789 if (IsInCombat() && cd <= m_regenTimer)
1790 SetGracePeriod(i, m_regenTimer - cd + 1); // added 1 because m_regenTimer-cd can be equal 0
1791 }
1792 // xinef: if grace is started, increase it but no more than cap
1793 else if (uint32 grace = GetGracePeriod(i))
1794 {
1795 if (grace < RUNE_GRACE_PERIOD)
1796 SetGracePeriod(i, std::min<uint32>(grace + m_regenTimer, RUNE_GRACE_PERIOD));
1797 }
1798 }
1799
1800 if (m_regenTimerCount >= 2000)
1801 {
1802 // Not in combat or they have regeneration
1806 {
1808 }
1809
1813
1814 m_regenTimerCount -= 2000;
1815 }
1816
1817 m_regenTimer = 0;
1818
1819 // Handles the emotes for drinking and eating.
1820 // According to sniffs there is a background timer going on that repeats independed from the time window where the aura applies.
1821 // That's why we dont need to reset the timer on apply. In sniffs I have seen that the first call for the spell visual is totally random, then after
1822 // 5 seconds over and over again which confirms my theory that we have a independed timer.
1823 if (m_foodEmoteTimerCount >= 5000)
1824 {
1825 std::vector<AuraEffect*> auraList;
1828
1829 auraList.reserve(ModRegenAuras.size() + ModPowerRegenAuras.size());
1830 auraList.insert(auraList.end(), ModRegenAuras.begin(), ModRegenAuras.end());
1831 auraList.insert(auraList.end(), ModPowerRegenAuras.begin(), ModPowerRegenAuras.end());
1832
1833 for (auto itr = auraList.begin(); itr != auraList.end(); ++itr)
1834 {
1835 // Food emote comes above drinking emote if we have to decide (mage regen food for example)
1836 if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
1837 {
1839 break;
1840 }
1841 else if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
1842 {
1844 break;
1845 }
1846 }
1847 m_foodEmoteTimerCount -= 5000;
1848 }
1849}
@ RUNE_GRACE_PERIOD
Definition Player.h:409
@ SPELL_VISUAL_KIT_DRINK
Definition SharedDefines.h:350
@ SPELL_VISUAL_KIT_FOOD
Definition SharedDefines.h:349
@ SPELL_AURA_MOD_REGEN
Definition SpellAuraDefines.h:147
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition SpellDefines.h:61
void Regenerate(Powers power)
Definition Player.cpp:1851
void RegenerateHealth()
Definition Player.cpp:1996
bool IsPolymorphed() const
Definition Unit.cpp:16815
void SendPlaySpellVisual(uint32 id)
Definition Unit.cpp:18999
bool HasRegenDuringCombatAura() const
Definition Unit.h:1749
bool HasHealthRegenInCombatAura() const
Definition Unit.h:1748

References AURA_INTERRUPT_FLAG_NOT_SEATED, CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, Unit::GetAuraEffectsByType(), GetGracePeriod(), GetRuneCooldown(), Unit::HasHealthRegenInCombatAura(), Unit::HasRegenDuringCombatAura(), IsClass(), Unit::IsInCombat(), Unit::IsPolymorphed(), m_baseHealthRegen, m_foodEmoteTimerCount, Unit::m_regenTimer, m_regenTimerCount, MAX_RUNES, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Regenerate(), RegenerateHealth(), RUNE_GRACE_PERIOD, Unit::SendPlaySpellVisual(), SetGracePeriod(), SetRuneCooldown(), SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_REGEN, SPELL_VISUAL_KIT_DRINK, and SPELL_VISUAL_KIT_FOOD.

Referenced by Update().

◆ RegenerateHealth()

void Player::RegenerateHealth ( )
1997{
1998 uint32 curValue = GetHealth();
1999 uint32 maxValue = GetMaxHealth();
2000
2001 if (curValue >= maxValue)
2002 return;
2003
2004 float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
2005
2006 if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
2007 HealthIncreaseRate = sWorld->getRate(RATE_HEALTH) * (2.066f - (GetLevel() * 0.066f));
2008
2009 float addvalue = 0.0f;
2010
2011 // polymorphed case
2012 if (IsPolymorphed())
2013 addvalue = (float)GetMaxHealth() / 3;
2014 // normal regen case (maybe partly in combat case)
2015 else if (!IsInCombat() || HasRegenDuringCombatAura())
2016 {
2017 addvalue = OCTRegenHPPerSpirit() * HealthIncreaseRate;
2018
2019 if (!IsStandState())
2020 {
2021 addvalue *= 1.33f;
2022 }
2023
2025 for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
2026 {
2027 AddPct(addvalue, (*i)->GetAmount());
2028 }
2029
2030 if (!IsInCombat())
2031 {
2033 }
2034 else if (HasRegenDuringCombatAura())
2035 {
2037 }
2038 }
2039
2040 // always regeneration bonus (including combat)
2042 addvalue += m_baseHealthRegen / 2.5f;
2043
2044 if (addvalue < 0)
2045 addvalue = 0;
2046
2047 ModifyHealth(int32(addvalue));
2048}
@ SPELL_AURA_MOD_REGEN_DURING_COMBAT
Definition SpellAuraDefines.h:179
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
Definition SpellAuraDefines.h:151
@ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
Definition SpellAuraDefines.h:224
T ApplyPct(T &base, U pct)
Definition Util.h:73
@ RATE_HEALTH
Definition WorldConfig.h:382
float OCTRegenHPPerSpirit()
Definition Player.cpp:5250
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14183
bool IsStandState() const
Definition Unit.cpp:16794

References AddPct(), ApplyPct(), CONFIG_LOW_LEVEL_REGEN_BOOST, Unit::GetAuraEffectsByType(), Unit::GetHealth(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetTotalAuraModifier(), Unit::HasRegenDuringCombatAura(), IN_MILLISECONDS, Unit::IsInCombat(), Unit::IsPolymorphed(), Unit::IsStandState(), m_baseHealthRegen, Unit::ModifyHealth(), OCTRegenHPPerSpirit(), RATE_HEALTH, SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT, SPELL_AURA_MOD_REGEN, SPELL_AURA_MOD_REGEN_DURING_COMBAT, and sWorld.

Referenced by RegenerateAll().

◆ removeActionButton()

void Player::removeActionButton ( uint8  button)
5671{
5672 ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
5673 if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
5674 return;
5675
5676 if (buttonItr->second.uState == ACTIONBUTTON_NEW)
5677 m_actionButtons.erase(buttonItr); // new and not saved
5678 else
5679 buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
5680
5681 LOG_DEBUG("entities.player", "Action Button {} Removed from Player {}", button, GetGUID().ToString());
5682}

References ACTIONBUTTON_DELETED, ACTIONBUTTON_NEW, Object::GetGUID(), LOG_DEBUG, m_actionButtons, Position::ToString(), and ActionButton::uState.

Referenced by WorldSession::HandleSetActionButtonOpcode().

◆ RemoveActiveQuest()

void Player::RemoveActiveQuest ( uint32  questId,
bool  update = true 
)
1496{
1497 QuestStatusMap::iterator itr = m_QuestStatus.find(questId);
1498 if (itr != m_QuestStatus.end())
1499 {
1500 m_QuestStatus.erase(itr);
1501 m_QuestStatusSave[questId] = false;
1502 }
1503
1504 if (update)
1505 SendQuestUpdate(questId);
1506
1507 // Xinef: area auras may change on quest remove!
1511}

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), WorldObject::GetAreaId(), WorldObject::GetZoneId(), m_QuestStatus, m_QuestStatusSave, SendQuestUpdate(), UpdateAreaDependentAuras(), and UpdateZoneDependentAuras().

Referenced by Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), and RewardQuest().

◆ RemoveAllSpellCooldown()

void Player::RemoveAllSpellCooldown ( )
3600{
3602 if (!m_spellCooldowns.empty())
3603 {
3604 for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
3605 if (itr->second.end < infTime)
3606 SendClearCooldown(itr->first, this);
3607
3608 m_spellCooldowns.clear();
3609 }
3610}
void SendClearCooldown(uint32 spell_id, Unit *target)
Definition Player.cpp:14620

References GameTime::GetGameTimeMS(), infinityCooldownDelayCheck, m_spellCooldowns, and SendClearCooldown().

Referenced by misc_commandscript::HandleCooldownCommand().

◆ RemoveAmmo()

◆ RemoveArenaEnchantments()

void Player::RemoveArenaEnchantments ( EnchantmentSlot  slot)
4226{
4227 // remove enchantments from equipped items first to clean up the m_enchantDuration list
4228 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next)
4229 {
4230 next = itr;
4231 if (itr->slot == slot)
4232 {
4233 if (itr->item && itr->item->GetEnchantmentId(slot))
4234 {
4235 // Poisons and DK runes are enchants which are allowed on arenas
4236 if (sSpellMgr->IsArenaAllowedEnchancment(itr->item->GetEnchantmentId(slot)))
4237 {
4238 ++next;
4239 continue;
4240 }
4241 // remove from stats
4242 ApplyEnchantment(itr->item, slot, false, false);
4243 // remove visual
4244 itr->item->ClearEnchantment(slot);
4245 }
4246 // remove from update list
4247 next = m_enchantDuration.erase(itr);
4248 }
4249 else
4250 ++next;
4251 }
4252
4253 // Xinef: check arena allowed enchantments :)
4254 // remove enchants from inventory items
4255 // NOTE: no need to remove these from stats, since these aren't equipped
4256 // in inventory
4258 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4259 if (uint32 enchId = pItem->GetEnchantmentId(slot))
4260 if (!sSpellMgr->IsArenaAllowedEnchancment(enchId))
4261 pItem->ClearEnchantment(slot);
4262
4263 // in inventory bags
4265 if (Bag* pBag = GetBagByPos(i))
4266 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4267 if (Item* pItem = pBag->GetItemByPos(j))
4268 if (uint32 enchId = pItem->GetEnchantmentId(slot))
4269 if (!sSpellMgr->IsArenaAllowedEnchancment(enchId))
4270 pItem->ClearEnchantment(slot);
4271}

References ApplyEnchantment(), GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, m_enchantDuration, and sSpellMgr.

Referenced by Battleground::AddPlayer().

◆ RemoveArenaSpellCooldowns()

void Player::RemoveArenaSpellCooldowns ( bool  removeActivePetCooldowns = false)
3565{
3566 // remove cooldowns on spells that have < 10 min CD
3568 SpellCooldowns::iterator itr, next;
3569 for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next)
3570 {
3571 next = itr;
3572 ++next;
3573 SpellInfo const* spellInfo = sSpellMgr->CheckSpellInfo(itr->first);
3574 if (!spellInfo)
3575 {
3576 continue;
3577 }
3578
3580 RemoveSpellCooldown(itr->first, true);
3581 else if (spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS && itr->second.end < infTime// xinef: dont remove active cooldowns - bugz
3582 && itr->second.maxduration < 10 * MINUTE * IN_MILLISECONDS) // xinef: dont clear cooldowns that have maxduration > 10 minutes (eg item cooldowns with no spell.dbc cooldown info)
3583 RemoveSpellCooldown(itr->first, true);
3584 }
3585
3586 // pet cooldowns
3587 if (removeActivePetCooldowns)
3588 if (Pet* pet = GetPet())
3589 {
3590 // notify player
3591 for (CreatureSpellCooldowns::const_iterator itr2 = pet->m_CreatureSpellCooldowns.begin(); itr2 != pet->m_CreatureSpellCooldowns.end(); ++itr2)
3592 SendClearCooldown(itr2->first, pet);
3593
3594 // actually clear cooldowns
3595 pet->m_CreatureSpellCooldowns.clear();
3596 }
3597}
@ SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS
Definition SharedDefines.h:547
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3548

References SpellInfo::CategoryRecoveryTime, GameTime::GetGameTimeMS(), GetPet(), SpellInfo::HasAttribute(), IN_MILLISECONDS, infinityCooldownDelayCheck, m_spellCooldowns, MINUTE, SpellInfo::RecoveryTime, RemoveSpellCooldown(), SendClearCooldown(), SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS, and sSpellMgr.

Referenced by TeleportTo().

◆ RemoveAtLoginFlag()

void Player::RemoveAtLoginFlag ( AtLoginFlags  flags,
bool  persist = false 
)
14606{
14607 m_atLoginFlags &= ~flags;
14608
14609 if (persist)
14610 {
14612
14613 stmt->SetData(0, uint16(flags));
14614 stmt->SetData(1, GetGUID().GetCounter());
14615
14616 CharacterDatabase.Execute(stmt);
14617 }
14618}
@ CHAR_UPD_REM_AT_LOGIN_FLAG
Definition CharacterDatabase.h:277

References CHAR_UPD_REM_AT_LOGIN_FLAG, CharacterDatabase, Object::GetGUID(), m_atLoginFlags, and PreparedStatementBase::SetData().

Referenced by WorldSession::HandlePlayerLoginFromDB(), LoadCorpse(), resetSpells(), Pet::resetTalents(), resetTalents(), and Pet::resetTalentsForAllPetsOf().

◆ RemoveBattlegroundQueueId()

void Player::RemoveBattlegroundQueueId ( BattlegroundQueueTypeId  val)
12238{
12239 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12240 {
12241 if (_BgBattlegroundQueueID[i].bgQueueTypeId == val)
12242 {
12244 _BgBattlegroundQueueID[i].invitedToInstance = 0;
12245 return;
12246 }
12247 }
12248}

References _BgBattlegroundQueueID, BATTLEGROUND_QUEUE_NONE, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by BGQueueRemoveEvent::Execute(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::LogoutPlayer(), and Battleground::RemovePlayerAtLeave().

◆ RemoveBonusTalent()

void Player::RemoveBonusTalent ( uint32  count)
inline
1750{ m_extraBonusTalentCount -= count; };

References m_extraBonusTalentCount.

◆ RemoveCategoryCooldown()

void Player::RemoveCategoryCooldown ( uint32  cat)
3557{
3558 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
3559 if (i_scstore != sSpellsByCategoryStore.end())
3560 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
3561 RemoveSpellCooldown(i_scset->second, true);
3562}

References RemoveSpellCooldown(), and sSpellsByCategoryStore.

Referenced by spell_hun_readiness::HandleDummy(), spell_item_refocus::HandleDummy(), and Unit::HandleProcTriggerSpell().

◆ RemoveCorpse()

void Player::RemoveCorpse ( )
4707{
4708 if (GetCorpse())
4709 {
4711 }
4712
4713 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
4714 Corpse::DeleteFromDB(GetGUID(), trans);
4715 CharacterDatabase.CommitTransaction(trans);
4716
4718}
void RemoveFromWorld() override
Definition Corpse.cpp:52

References _corpseLocation, CharacterDatabase, Corpse::DeleteFromDB(), GetCorpse(), Object::GetGUID(), Corpse::RemoveFromWorld(), and WorldLocation::WorldRelocate().

Referenced by WorldSession::HandleMoveWorldportAck().

◆ RemovedInsignia()

void Player::RemovedInsignia ( Player looterPlr)
7752{
7753 // Xinef: If player is not in battleground and not in wintergrasp
7755 return;
7756
7757 // If not released spirit, do it !
7758 if (m_deathTimer > 0)
7759 {
7760 m_deathTimer = 0;
7763 }
7764
7766
7767 // We have to convert player corpse to bones, not to be able to resurrect there
7768 // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
7769 Corpse* bones = GetMap()->ConvertCorpseToBones(GetGUID(), true);
7770 if (!bones)
7771 return;
7772
7773 // Now we must make bones lootable, and send player loot
7775
7776 // We store the level of our player in the gold field
7777 // We retrieve this information at Player::SendLoot()
7778 bones->loot.gold = GetLevel();
7779 bones->lootRecipient = looterPlr;
7780 looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
7781}
@ AREA_WINTERGRASP
Definition AreaDefines.h:144
@ LOOT_INSIGNIA
Definition LootMgr.h:90
@ CORPSE_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3372
@ CORPSE_FIELD_DYNAMIC_FLAGS
Definition UpdateFields.h:428
Player * lootRecipient
Definition Corpse.h:78
Loot loot
Definition Corpse.h:77
Corpse * ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia=false)
Definition Map.cpp:2598
void SendLoot(ObjectGuid guid, LootType loot_type)
Definition Player.cpp:7790
void BuildPlayerRepop()
Definition Player.cpp:4455
uint32 gold
Definition LootMgr.h:322

References _corpseLocation, AREA_WINTERGRASP, BuildPlayerRepop(), Map::ConvertCorpseToBones(), CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, GetBattlegroundId(), Object::GetGUID(), Object::GetGUID(), Unit::GetLevel(), WorldObject::GetMap(), WorldObject::GetZoneId(), Loot::gold, Corpse::loot, LOOT_INSIGNIA, Corpse::lootRecipient, m_deathTimer, RepopAtGraveyard(), SendLoot(), Object::SetFlag(), and WorldLocation::WorldRelocate().

Referenced by Spell::EffectSkinPlayerCorpse().

◆ RemoveEnchantmentDurations()

void Player::RemoveEnchantmentDurations ( Item item)
4200{
4201 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();)
4202 {
4203 if (itr->item == item)
4204 {
4205 // save duration in item
4206 item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration, this);
4207 itr = m_enchantDuration.erase(itr);
4208 }
4209 else
4210 ++itr;
4211 }
4212}
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
Definition Item.cpp:941

References m_enchantDuration, and Item::SetEnchantmentDuration().

Referenced by _StoreItem(), DestroyItem(), EquipItem(), and RemoveItem().

◆ RemoveEnchantmentDurationsReferences()

void Player::RemoveEnchantmentDurationsReferences ( Item item)
4215{
4216 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();)
4217 {
4218 if (itr->item == item)
4219 itr = m_enchantDuration.erase(itr);
4220 else
4221 ++itr;
4222 }
4223}

References m_enchantDuration.

Referenced by _SaveInventory().

◆ RemoveFromBattlegroundOrBattlefieldRaid()

void Player::RemoveFromBattlegroundOrBattlefieldRaid ( )
13067{
13068 //remove existing reference
13069 m_group.unlink();
13070 if (Group* group = GetOriginalGroup())
13071 {
13072 m_group.link(group, this);
13074 }
13075 SetOriginalGroup(nullptr);
13076}
void setSubGroup(uint8 pSubGroup)
Definition GroupReference.h:39
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition Player.cpp:13078
Group * GetOriginalGroup()
Definition Player.h:2500
uint8 GetOriginalSubGroup() const
Definition Player.h:2502
void unlink()
Definition Reference.h:62
void link(TO *toObj, FROM *fromObj)
Definition Reference.h:45

References GetOriginalGroup(), GetOriginalSubGroup(), Reference< TO, FROM >::link(), m_group, SetOriginalGroup(), GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::Disband(), and Group::RemoveMember().

◆ RemoveFromGroup() [1/2]

void Player::RemoveFromGroup ( Group group,
ObjectGuid  guid,
RemoveMethod  method = GROUP_REMOVEMETHOD_DEFAULT,
ObjectGuid  kicker = ObjectGuid::Empty,
const char *  reason = nullptr 
)
static
2358{
2359 if (group)
2360 {
2361 group->RemoveMember(guid, method, kicker, reason);
2362 group = nullptr;
2363 }
2364}
bool RemoveMember(ObjectGuid guid, const RemoveMethod &method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
Definition Group.cpp:545

References Group::RemoveMember().

Referenced by DeleteFromDB(), WorldSession::HandleGroupDisbandOpcode(), WorldSession::HandleGroupUninviteGuidOpcode(), WorldSession::HandleGroupUninviteOpcode(), WorldSession::LogoutPlayer(), and lfg::LFGMgr::UpdateBoot().

◆ RemoveFromGroup() [2/2]

void Player::RemoveFromGroup ( RemoveMethod  method = GROUP_REMOVEMETHOD_DEFAULT)
inline
1902{ RemoveFromGroup(GetGroup(), GetGUID(), method); }

References GetGroup(), Object::GetGUID(), and RemoveFromGroup().

Referenced by RemoveFromGroup().

◆ RemoveFromWhisperWhiteList()

void Player::RemoveFromWhisperWhiteList ( ObjectGuid  guid)
inline
2578{ WhisperList.remove(guid); }

References WhisperList.

Referenced by message_commandscript::HandleWhispersCommand().

◆ RemoveFromWorld()

void Player::RemoveFromWorld ( )
overridevirtual
  • Release charmed creatures, unsummon totems and remove pets/guardians
  • Do not add/remove the player from the object storage
  • It will crash when updating the ObjectAccessor
  • The player should only be removed when logging out

Reimplemented from Object.

1726{
1727 // cleanup
1728 if (IsInWorld())
1729 {
1734 ClearComboPoints(); // pussywizard: crashfix
1735 ClearComboPointHolders(); // pussywizard: crashfix
1736 if (ObjectGuid lguid = GetLootGUID()) // pussywizard: crashfix
1737 m_session->DoLootRelease(lguid);
1738 sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1739 sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1740 sWorldState->HandlePlayerLeaveZone(this, static_cast<AreaTableIDs>(m_zoneUpdateId));
1741 }
1742
1743 // Remove items from world before self - player must be found in Item::RemoveFromObjectUpdate
1744 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
1745 {
1746 if (m_items[i])
1748 }
1749
1750 for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
1751 iter->second->RemoveFromWorld();
1752
1757
1758 if (m_uint32Values)
1759 {
1760 if (WorldObject* viewpoint = GetViewpoint())
1761 {
1762 LOG_FATAL("entities.player", "Player {} has viewpoint {} {} when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
1763 SetViewpoint(viewpoint, false);
1764 }
1765 }
1766}
AreaTableIDs
Definition AreaDefines.h:24
#define LOG_FATAL(filterType__,...)
Definition Log.h:154
#define sWorldState
Definition WorldState.h:376
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:13135
void UnsummonPetTemporaryIfAny()
Definition Player.cpp:14186
WorldObject * GetViewpoint() const
Definition Player.cpp:13178
void ClearComboPointHolders()
Definition Unit.cpp:16993
void RemoveFromWorld() override
Definition Unit.cpp:15774
void DoLootRelease(ObjectGuid lguid)
Definition LootHandler.cpp:270

References Unit::ClearComboPointHolders(), Unit::ClearComboPoints(), WorldSession::DoLootRelease(), GetLootGUID(), WorldObject::GetName(), GetViewpoint(), Object::IsInWorld(), LOG_FATAL, m_items, m_session, Object::m_uint32Values, m_zoneUpdateId, mMitems, PLAYER_SLOT_END, PLAYER_SLOT_START, Object::RemoveFromWorld(), Unit::RemoveFromWorld(), sBattlefieldMgr, SetViewpoint(), sOutdoorPvPMgr, StopCastingBindSight(), StopCastingCharm(), sWorldState, and UnsummonPetTemporaryIfAny().

Referenced by Map::RemovePlayerFromMap().

◆ RemoveItem()

void Player::RemoveItem ( uint8  bag,
uint8  slot,
bool  update,
bool  swap = false 
)
2900{
2901 // note: removeitem does not actually change the item
2902 // it only takes the item out of storage temporarily
2903 // note2: if removeitem is to be used for delinking
2904 // the item must be removed from the player's updatequeue
2905
2906 Item* pItem = GetItemByPos(bag, slot);
2907 if (pItem)
2908 {
2909 LOG_DEBUG("entities.player.items", "STORAGE: RemoveItem bag = {}, slot = {}, item = {}", bag, slot, pItem->GetEntry());
2910
2912 RemoveItemDurations(pItem);
2913 RemoveTradeableItem(pItem);
2914
2915 if (bag == INVENTORY_SLOT_BAG_0)
2916 {
2917 if (slot < INVENTORY_SLOT_BAG_END)
2918 {
2919 ItemTemplate const* pProto = pItem->GetTemplate();
2920 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
2921
2922 if (pProto && pProto->ItemSet)
2923 RemoveItemsSetItem(this, pProto);
2924
2925 _ApplyItemMods(pItem, slot, false);
2926 }
2927
2928 m_items[slot] = nullptr;
2929
2930 // remove item dependent auras and casts (only weapon and armor slots)
2931 if (slot < INVENTORY_SLOT_BAG_END && slot < EQUIPMENT_SLOT_END)
2932 {
2933 // Xinef: Ensure that this function is called for places with swap=true
2934 if (!swap)
2935 {
2937 }
2938
2939 // remove held enchantments, update expertise
2940 if (slot == EQUIPMENT_SLOT_MAINHAND)
2941 {
2943 }
2944 else if (slot == EQUIPMENT_SLOT_OFFHAND)
2945 {
2947 }
2948
2949 // update armor penetration - passive auras may need it
2950 switch (slot)
2951 {
2956 default:
2957 break;
2958 }
2959 }
2960
2962
2963 if (slot < EQUIPMENT_SLOT_END)
2964 SetVisibleItemSlot(slot, nullptr);
2965 }
2966 else if (Bag* pBag = GetBagByPos(bag))
2967 pBag->RemoveItem(slot, update);
2968
2970 // pItem->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty); not clear owner at remove (it will be set at store). This used in mail and auction code
2971 pItem->SetSlot(NULL_SLOT);
2972 if (IsInWorld() && update)
2973 pItem->SendUpdateToPlayer(this);
2974 }
2975}

References _ApplyItemMods(), BASE_ATTACK, CR_ARMOR_PENETRATION, ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetBagByPos(), Object::GetEntry(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, Object::IsInWorld(), ITEM_FIELD_CONTAINED, ItemTemplate::ItemSet, LOG_DEBUG, m_items, NULL_SLOT, OFF_ATTACK, PLAYER_FIELD_INV_SLOT_HEAD, RecalculateRating(), RemoveEnchantmentDurations(), RemoveItemDependentAurasAndCasts(), RemoveItemDurations(), RemoveItemsSetItem(), RemoveTradeableItem(), Object::SendUpdateToPlayer(), Object::SetGuidValue(), Item::SetSlot(), SetVisibleItemSlot(), and UpdateExpertise().

Referenced by AutoUnequipOffhandIfNeed(), Create(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleSellItemOpcode(), MoveItemFromInventory(), and SwapItem().

◆ RemoveItemDependentAurasAndCasts()

void Player::RemoveItemDependentAurasAndCasts ( Item pItem)
12550{
12551 for (AuraMap::iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end();)
12552 {
12553 Aura* aura = itr->second;
12554
12555 // skip passive (passive item dependent spells work in another way) and not self applied auras
12556 SpellInfo const* spellInfo = aura->GetSpellInfo();
12557 if (aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
12558 {
12559 ++itr;
12560 continue;
12561 }
12562
12563 // skip if not item dependent or have alternative item
12564 if (HasItemFitToSpellRequirements(spellInfo, pItem))
12565 {
12566 ++itr;
12567 continue;
12568 }
12569
12570 // no alt item, remove aura, restart check
12571 RemoveOwnedAura(itr);
12572 }
12573
12574 // currently casted spells can be dependent from item
12575 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
12576 if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
12577 if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellRequirements(spell->m_spellInfo, pItem))
12579}
@ SPELL_STATE_DELAYED
Definition Spell.h:231
#define CURRENT_MAX_SPELL
Definition Unit.h:545
bool HasItemFitToSpellRequirements(SpellInfo const *spellInfo, Item const *ignoreItem=nullptr) const
Definition Player.cpp:12487

References CURRENT_MAX_SPELL, Aura::GetCasterGUID(), Unit::GetCurrentSpell(), Object::GetGUID(), Aura::GetSpellInfo(), HasItemFitToSpellRequirements(), Unit::InterruptSpell(), Aura::IsPassive(), Unit::m_ownedAuras, Unit::RemoveOwnedAura(), and SPELL_STATE_DELAYED.

Referenced by DestroyItem(), WorldSession::HandleAutoEquipItemOpcode(), RemoveItem(), and SwapItem().

◆ RemoveItemDurations()

void Player::RemoveItemDurations ( Item item)
12412{
12413 for (ItemDurationList::iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
12414 {
12415 if (*itr == item)
12416 {
12417 m_itemDuration.erase(itr);
12418 break;
12419 }
12420 }
12421}

References m_itemDuration.

Referenced by _SaveInventory(), _StoreItem(), DestroyItem(), EquipItem(), and RemoveItem().

◆ RemoveItemFromBuyBackSlot()

void Player::RemoveItemFromBuyBackSlot ( uint32  slot,
bool  del 
)
3996{
3997 LOG_DEBUG("entities.player.items", "STORAGE: RemoveItemFromBuyBackSlot slot = {}", slot);
3998 if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END)
3999 {
4000 Item* pItem = m_items[slot];
4001 if (pItem)
4002 {
4003 pItem->RemoveFromWorld();
4004 if (del)
4005 pItem->SetState(ITEM_REMOVED, this);
4006 }
4007
4008 m_items[slot] = nullptr;
4009
4010 uint32 eslot = slot - BUYBACK_SLOT_START;
4014
4015 // if current backslot is filled set to now free slot
4017 m_currentBuybackSlot = slot;
4018 }
4019}

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, ObjectGuid::Empty, ITEM_REMOVED, LOG_DEBUG, m_currentBuybackSlot, m_items, PLAYER_FIELD_BUYBACK_PRICE_1, PLAYER_FIELD_BUYBACK_TIMESTAMP_1, PLAYER_FIELD_VENDORBUYBACK_SLOT_1, Object::RemoveFromWorld(), Object::SetGuidValue(), Item::SetState(), and Unit::SetUInt32Value().

Referenced by AddItemToBuyBackSlot(), WorldSession::HandleBuybackItem(), and reset_commandscript::ResetItemsInVendorBuyBackTab().

◆ RemoveMail()

void Player::RemoveMail ( uint32  id)
2861{
2862 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
2863 {
2864 if ((*itr)->messageID == id)
2865 {
2866 //do not delete item, because Player::removeMail() is called when returning mail to sender.
2867 m_mail.erase(itr);
2868 return;
2869 }
2870 }
2871}

References m_mail.

Referenced by WorldSession::HandleMailReturnToSender().

◆ RemoveMItem()

bool Player::RemoveMItem ( ObjectGuid::LowType  itemLowGuid)
inline
1694 {
1695 return !!mMitems.erase(itemLowGuid);
1696 }

References mMitems.

Referenced by WorldSession::HandleMailReturnToSender(), and WorldSession::HandleMailTakeItem().

◆ RemovePet()

void Player::RemovePet ( Pet pet,
PetSaveMode  mode,
bool  returnreagent = false 
)
9087{
9088 if (!pet)
9089 pet = GetPet();
9090
9091 if (pet)
9092 {
9093 // xinef: dont save dead pet as current, save him not in slot
9094 if (!pet->IsAlive() && mode == PET_SAVE_AS_CURRENT && pet->getPetType() == HUNTER_PET)
9095 {
9096 mode = PET_SAVE_NOT_IN_SLOT;
9098 }
9099
9100 LOG_DEBUG("entities.pet", "RemovePet {}, {}, {}", pet->GetEntry(), mode, returnreagent);
9101 if (pet->m_removed)
9102 return;
9103 }
9104
9105 if (returnreagent && (pet || (m_temporaryUnsummonedPetNumber && (!m_session || !m_session->PlayerLogout()))) && !InBattleground())
9106 {
9107 //returning of reagents only for players, so best done here
9109 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
9110
9111 if (spellInfo)
9112 {
9113 for (uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i)
9114 {
9115 if (spellInfo->Reagent[i] > 0)
9116 {
9117 ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
9118 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i]);
9119 if (msg == EQUIP_ERR_OK)
9120 {
9121 Item* item = StoreNewItem(dest, spellInfo->Reagent[i], true);
9122 if (IsInWorld())
9123 SendNewItem(item, spellInfo->ReagentCount[i], true, false);
9124 }
9125 }
9126 }
9127 }
9129 }
9130
9131 if (!pet)
9132 {
9133 if (mode == PET_SAVE_NOT_IN_SLOT && m_petStable && m_petStable->CurrentPet)
9134 {
9135 // Handle removing pet while it is in "temporarily unsummoned" state, for example on mount
9137 stmt->SetData(0, PET_SAVE_NOT_IN_SLOT);
9138 stmt->SetData(1, GetGUID().GetCounter());
9139 stmt->SetData(2, m_petStable->CurrentPet->PetNumber);
9140 CharacterDatabase.Execute(stmt);
9141
9142 m_petStable->UnslottedPets.push_back(std::move(*m_petStable->CurrentPet));
9143 m_petStable->CurrentPet.reset();
9144 }
9145
9146 return;
9147 }
9148 else
9149 {
9150 pet->CombatStop();
9151
9152 // only if current pet in slot
9153 pet->SavePetToDB(mode);
9154
9155 if (m_petStable->CurrentPet && m_petStable->CurrentPet->PetNumber == pet->GetCharmInfo()->GetPetNumber())
9156 {
9157 if (mode == PET_SAVE_NOT_IN_SLOT)
9158 {
9159 m_petStable->UnslottedPets.push_back(std::move(*m_petStable->CurrentPet));
9160 m_petStable->CurrentPet.reset();
9161 }
9162 else if (mode == PET_SAVE_AS_DELETED)
9163 m_petStable->CurrentPet.reset();
9164 // else if (stable slots) handled in opcode handlers due to required swaps
9165 // else (current pet) doesnt need to do anything
9166 }
9167
9168 SetMinion(pet, false);
9169
9170 pet->AddObjectToRemoveList();
9171 pet->m_removed = true;
9172
9173 if (pet->isControlled())
9174 {
9176 data << uint64(0);
9177 GetSession()->SendPacket(&data);
9178
9179 if (GetGroup())
9181 }
9182
9184 {
9187 }
9188 }
9189}
@ CHAR_UPD_CHAR_PET_SLOT_BY_ID
Definition CharacterDatabase.h:485
#define MAX_SPELL_REAGENTS
Definition DBCStructure.h:1640
@ GROUP_UPDATE_PET
Definition Group.h:120
@ PET_SAVE_AS_DELETED
Definition PetDefines.h:41
@ UNIT_CREATED_BY_SPELL
Definition UpdateFields.h:138
PetType getPetType() const
Definition Pet.h:52
bool isControlled() const
Definition Pet.h:54
bool m_removed
Definition Pet.h:142
void SetGroupUpdateFlag(uint32 flag)
Definition Player.h:2491
std::array< int32, MAX_SPELL_REAGENTS > Reagent
Definition SpellInfo.h:373
std::array< uint32, MAX_SPELL_REAGENTS > ReagentCount
Definition SpellInfo.h:374
void AddObjectToRemoveList()
Definition Object.cpp:2109
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition ArenaSpectator.h:62
uint32 GetPetNumber() const
Definition CharmInfo.h:132

References WorldObject::AddObjectToRemoveList(), CanStoreNewItem(), CHAR_UPD_CHAR_PET_SLOT_BY_ID, CharacterDatabase, Unit::CombatStop(), EQUIP_ERR_OK, CreatureTemplate::family, WorldObject::FindMap(), Unit::GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetGroup(), Object::GetGUID(), GetPet(), CharmInfo::GetPetNumber(), Pet::getPetType(), GetSession(), Object::GetUInt32Value(), GROUP_UPDATE_PET, HUNTER_PET, InBattleground(), Unit::IsAlive(), Pet::isControlled(), Object::IsInWorld(), LOG_DEBUG, m_oldpetspell, m_petStable, Pet::m_removed, m_session, m_temporaryUnsummonedPetNumber, MAX_SPELL_REAGENTS, NeedSendSpectatorData(), NULL_BAG, NULL_SLOT, PET_SAVE_AS_CURRENT, PET_SAVE_AS_DELETED, PET_SAVE_NOT_IN_SLOT, WorldSession::PlayerLogout(), SpellInfo::Reagent, SpellInfo::ReagentCount, Pet::SavePetToDB(), ArenaSpectator::SendCommand_UInt32Value(), SendNewItem(), WorldSession::SendPacket(), PreparedStatementBase::SetData(), SetGroupUpdateFlag(), Unit::SetMinion(), SMSG_PET_SPELLS, sSpellMgr, StoreNewItem(), and UNIT_CREATED_BY_SPELL.

Referenced by Spell::_cast(), ActivateSpec(), Spell::EffectSummonPet(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleUnstablePet(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Pet::Remove(), resetTalents(), setDeathState(), SummonPet(), UnsummonPetTemporaryIfAny(), and Update().

◆ RemovePetitionsAndSigns()

void Player::RemovePetitionsAndSigns ( ObjectGuid  guid,
uint32  type 
)
static
10098{
10099 SignatureContainer* signatureStore = sPetitionMgr->GetSignatureStore();
10100 for (SignatureContainer::iterator itr = signatureStore->begin(); itr != signatureStore->end(); ++itr)
10101 {
10102 SignatureMap::iterator signItr = itr->second.signatureMap.find(guid);
10103 if (signItr != itr->second.signatureMap.end())
10104 {
10105 Petition const* petition = sPetitionMgr->GetPetition(itr->first);
10106 if (!petition || (type != 10 && type != petition->petitionType))
10107 continue;
10108
10109 // erase this
10110 itr->second.signatureMap.erase(signItr);
10111
10112 // send update if charter owner in game
10114 if (owner)
10115 owner->GetSession()->SendPetitionQueryOpcode(petition->petitionGuid);
10116 }
10117 }
10118
10119 if (type == 10)
10120 {
10122 stmt->SetData(0, guid.GetCounter());
10123 CharacterDatabase.Execute(stmt);
10124 }
10125 else
10126 {
10128 stmt->SetData(0, guid.GetCounter());
10129 stmt->SetData(1, uint8(type));
10130 CharacterDatabase.Execute(stmt);
10131 }
10132
10133 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
10134 if (type == 10)
10135 {
10137 stmt->SetData(0, guid.GetCounter());
10138 trans->Append(stmt);
10139
10140 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER);
10141 stmt->SetData(0, guid.GetCounter());
10142 trans->Append(stmt);
10143
10144 // xinef: clear petition store
10145 sPetitionMgr->RemovePetitionByOwnerAndType(guid, 0);
10146 }
10147 else
10148 {
10150 stmt->SetData(0, guid.GetCounter());
10151 stmt->SetData(1, uint8(type));
10152 trans->Append(stmt);
10153
10155 stmt->SetData(0, guid.GetCounter());
10156 stmt->SetData(1, uint8(type));
10157 trans->Append(stmt);
10158
10159 // xinef: clear petition store
10160 sPetitionMgr->RemovePetitionByOwnerAndType(guid, uint8(type));
10161 }
10162 CharacterDatabase.CommitTransaction(trans);
10163}
@ CHAR_DEL_PETITION_SIGNATURE
Definition CharacterDatabase.h:237
@ CHAR_DEL_PETITION_SIGNATURE_BY_OWNER
Definition CharacterDatabase.h:453
@ CHAR_DEL_ALL_PETITION_SIGNATURES
Definition CharacterDatabase.h:236
@ CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE
Definition CharacterDatabase.h:455
@ CHAR_DEL_PETITION_BY_OWNER
Definition CharacterDatabase.h:452
@ CHAR_DEL_PETITION_BY_OWNER_AND_TYPE
Definition CharacterDatabase.h:454
#define sPetitionMgr
Definition PetitionMgr.h:87
std::map< ObjectGuid, Signatures > SignatureContainer
Definition PetitionMgr.h:52
void SendPetitionQueryOpcode(ObjectGuid petitionguid)
Definition PetitionsHandler.cpp:278
Definition PetitionMgr.h:39
ObjectGuid petitionGuid
Definition PetitionMgr.h:40
ObjectGuid ownerGuid
Definition PetitionMgr.h:41
uint8 petitionType
Definition PetitionMgr.h:42

References CHAR_DEL_ALL_PETITION_SIGNATURES, CHAR_DEL_PETITION_BY_OWNER, CHAR_DEL_PETITION_BY_OWNER_AND_TYPE, CHAR_DEL_PETITION_SIGNATURE, CHAR_DEL_PETITION_SIGNATURE_BY_OWNER, CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE, CharacterDatabase, ObjectAccessor::FindConnectedPlayer(), ObjectGuid::GetCounter(), GetSession(), Petition::ownerGuid, Petition::petitionGuid, Petition::petitionType, WorldSession::SendPetitionQueryOpcode(), PreparedStatementBase::SetData(), and sPetitionMgr.

Referenced by Guild::AddMember(), ArenaTeam::AddMember(), and DeleteFromDB().

◆ RemovePlayerFlag()

◆ RemoveQuestSlotState()

void Player::RemoveQuestSlotState ( uint16  slot,
uint32  state 
)
inline

◆ RemoveReceivedSpectatorResetFor()

void Player::RemoveReceivedSpectatorResetFor ( ObjectGuid  guid)
inline
2602{ m_receivedSpectatorResetFor.erase(guid); }

References m_receivedSpectatorResetFor.

◆ RemoveRestFlag()

void Player::RemoveRestFlag ( RestFlag  restFlag)
16133{
16134 uint32 oldRestMask = _restFlagMask;
16135 _restFlagMask &= ~restFlag;
16136
16137 if (oldRestMask && !_restFlagMask) // only remove flag/time on the last rest state remove
16138 {
16139 _restTime = 0;
16141 }
16142}

References _restFlagMask, _restTime, PLAYER_FLAGS_RESTING, and RemovePlayerFlag().

Referenced by Update(), UpdateArea(), and UpdateZone().

◆ RemoveRestState()

void Player::RemoveRestState ( )

◆ RemoveRewardedQuest()

void Player::RemoveRewardedQuest ( uint32  questId,
bool  update = true 
)
1514{
1515 RewardedQuestSet::iterator rewItr = m_RewardedQuests.find(questId);
1516 if (rewItr != m_RewardedQuests.end())
1517 {
1518 m_RewardedQuests.erase(rewItr);
1519 m_RewardedQuestsSave[questId] = false;
1520 }
1521
1522 if (update)
1523 SendQuestUpdate(questId);
1524}

References m_RewardedQuests, m_RewardedQuestsSave, and SendQuestUpdate().

Referenced by Spell::EffectQuestClear().

◆ RemoveRunesByAuraEffect()

void Player::RemoveRunesByAuraEffect ( AuraEffect const *  aura)
13353{
13354 for (uint8 i = 0; i < MAX_RUNES; ++i)
13355 {
13356 if (m_runes->runes[i].ConvertAura == aura)
13357 {
13358 ConvertRune(i, GetBaseRune(i));
13359 SetRuneConvertAura(i, nullptr);
13360 }
13361 }
13362}
AuraEffect const * ConvertAura
Definition Player.h:428

References RuneInfo::ConvertAura, ConvertRune(), GetBaseRune(), m_runes, MAX_RUNES, Runes::runes, and SetRuneConvertAura().

Referenced by AuraEffect::HandleAuraConvertRune(), Aura::HandleAuraSpecificMods(), and AuraEffect::HandlePeriodicDummyAuraTick().

◆ removeSpell()

void Player::removeSpell ( uint32  spellId,
uint8  removeSpecMask,
bool  onlyTemporary 
)
3358{
3359 PlayerSpellMap::iterator itr = m_spells.find(spell_id);
3360 if (itr == m_spells.end())
3361 return;
3362
3363 // pussywizard: nothing to do if already removed or not in specs of removeSpecMask
3364 if (itr->second->State == PLAYERSPELL_REMOVED || (itr->second->specMask & removeSpecMask) == 0)
3365 return;
3366
3367 // pussywizard: avoid any possible bugs
3368 if (onlyTemporary && itr->second->State != PLAYERSPELL_TEMPORARY)
3369 return;
3370
3371 // pussywizard: remove non-talent higher ranks (recursive)
3372 // pussywizard: do this at the beginning, not in the middle of removing!
3373 if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
3374 if (!GetTalentSpellPos(nextSpell))
3375 removeSpell(nextSpell, removeSpecMask, onlyTemporary);
3376
3377 // xinef: if current spell has talentcost, remove spells requiring this spell
3378 uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spell_id);
3379 if (GetTalentSpellCost(firstRankSpellId))
3380 {
3381 SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(firstRankSpellId);
3382 for (auto spellsItr = spellsRequiringSpell.first; spellsItr != spellsRequiringSpell.second; ++spellsItr)
3383 {
3384 removeSpell(spellsItr->second, removeSpecMask, onlyTemporary);
3385 }
3386 }
3387
3388 // pussywizard: re-search, it can be corrupted in prev loop
3389 itr = m_spells.find(spell_id);
3390 if (itr == m_spells.end())
3391 return;
3392
3393 itr->second->specMask = (((uint8)itr->second->specMask) & ~removeSpecMask); // pussywizard: update specMask in map
3394
3395 // pussywizard: some more conditions needed for spells like pyroblast (shouldn't be fully removed when not available in any spec, should stay in db with specMask = 0)
3396 if (GetTalentSpellCost(firstRankSpellId) == 0 && !sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId) && itr->second->specMask == 0)
3397 {
3398 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_TEMPORARY)
3399 {
3400 delete itr->second;
3401 m_spells.erase(itr);
3402 }
3403 else
3404 itr->second->State = PLAYERSPELL_REMOVED;
3405 }
3406 else if (itr->second->State != PLAYERSPELL_NEW && itr->second->State != PLAYERSPELL_TEMPORARY)
3407 itr->second->State = PLAYERSPELL_CHANGED;
3408
3409 // xinef: this is used for talents and they are not removed in removeSpell function...
3410 // xinef: however ill leave this here just in case
3411 // pussywizard: remove owned aura obtained from currently removed spell
3412 RemoveOwnedAura(spell_id);
3413
3414 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
3415 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3416 {
3417 // pussywizard: remove pet auras
3418 if (PetAura const* petSpell = sSpellMgr->GetPetAura(spell_id, i))
3419 RemovePetAura(petSpell);
3420
3421 // pussywizard: remove all triggered auras
3422 if (spellInfo->Effects[i].TriggerSpell > 0)
3423 RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell);
3424 }
3425
3426 // pussywizard: update free primary prof points
3427 if (spellInfo->IsPrimaryProfessionFirstRank())
3428 {
3429 uint32 freeProfs = GetFreePrimaryProfessionPoints() + 1;
3430 if (freeProfs <= sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL))
3431 SetFreePrimaryProfessions(freeProfs);
3432 }
3433
3434 // pussywizard: update 310 flyer
3435 if (Has310Flyer(false))
3436 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3437 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310)
3438 Has310Flyer(true, spell_id);
3439
3440 // pussywizard: remove dependent skill
3441 SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spell_id);
3442 if (spellLearnSkill)
3443 {
3444 uint32 prev_spell = sSpellMgr->GetPrevSpellInChain(spell_id);
3445
3446 if (!prev_spell) // pussywizard: first rank, remove skill
3447 SetSkill(spellLearnSkill->skill, 0, 0, 0);
3448 else // pussywizard: search previous ranks
3449 {
3450 SpellLearnSkillNode const* prevSkill = sSpellMgr->GetSpellLearnSkill(prev_spell);
3451 while (!prevSkill && prev_spell)
3452 {
3453 prev_spell = sSpellMgr->GetPrevSpellInChain(prev_spell);
3454 prevSkill = sSpellMgr->GetSpellLearnSkill(sSpellMgr->GetFirstSpellInChain(prev_spell));
3455 }
3456
3457 if (!prevSkill) // pussywizard: not found prev skill setting, remove skill
3458 SetSkill(spellLearnSkill->skill, 0, 0, 0);
3459 else // pussywizard: set to prev skill setting values
3460 {
3461 uint32 skill_value = GetPureSkillValue(prevSkill->skill);
3462 uint32 skill_max_value = GetPureMaxSkillValue(prevSkill->skill);
3463 uint32 new_skill_max_value = prevSkill->maxvalue == 0 ? GetMaxSkillValueForLevel() : prevSkill->maxvalue;
3464
3465 if (skill_value > prevSkill->value)
3466 skill_value = prevSkill->value;
3467 if (skill_max_value > new_skill_max_value)
3468 skill_max_value = new_skill_max_value;
3469
3470 SetSkill(prevSkill->skill, prevSkill->step, skill_value, skill_max_value);
3471 }
3472 }
3473 }
3474 else
3475 {
3476 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
3477 // most likely will never be used, haven't heard of cases where players unlearn a mount
3478 if (Has310Flyer(false) && spellInfo)
3479 {
3480 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
3481 {
3482 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine);
3483 if (!pSkill)
3484 continue;
3485
3486 if (_spell_idx->second->SkillLine == SKILL_MOUNTS)
3487 {
3488 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3489 {
3490 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
3491 spellInfo->Effects[i].CalcValue() == 310)
3492 {
3493 Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
3494 break;
3495 }
3496 }
3497 }
3498 }
3499 }
3500 }
3501
3502 // pussywizard: remove from spell book (can't be replaced by previous rank, because such spells can't be unlearnt)
3503 if (!onlyTemporary || ((!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)))
3504 {
3505 sScriptMgr->OnPlayerForgotSpell(this, spell_id);
3506 SendLearnPacket(spell_id, false);
3507 }
3508}

References CONFIG_MAX_PRIMARY_TRADE_SKILL, SpellInfo::Effects, GetFreePrimaryProfessionPoints(), GetMaxSkillValueForLevel(), GetPureMaxSkillValue(), GetPureSkillValue(), GetTalentSpellCost(), GetTalentSpellPos(), Has310Flyer(), SpellInfo::HasAnyAura(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), SpellInfo::IsPrimaryProfessionFirstRank(), m_spells, MAX_SPELL_EFFECTS, SpellLearnSkillNode::maxvalue, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), Unit::RemovePetAura(), removeSpell(), SendLearnPacket(), SetFreePrimaryProfessions(), SetSkill(), SpellLearnSkillNode::skill, SKILL_MOUNTS, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_ATTR0_PASSIVE, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSkillLineStore, sSpellMgr, SpellLearnSkillNode::step, and SpellLearnSkillNode::value.

Referenced by _LoadSpells(), _removeTalentAurasAndSpells(), Spell::EffectUnlearnSpecialization(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraOverrideSpells(), Acore::PlayerCommand::HandleUnlearnSpellCommand(), learnSkillRewardedSpells(), ProfessionUnlearnSpells(), removeSpell(), resetSpells(), resetTalents(), and SetSkill().

◆ RemoveSpellCooldown()

◆ RemoveSpellMods()

void Player::RemoveSpellMods ( Spell spell)
9989{
9990 if (!spell)
9991 return;
9992
9993 if (spell->m_appliedMods.empty())
9994 return;
9995
9996 SpellInfo const* const spellInfo = spell->m_spellInfo;
9997
9998 for (uint8 i = 0; i < MAX_SPELLMOD; ++i)
9999 {
10000 for (SpellModList::const_iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();)
10001 {
10002 SpellModifier* mod = *itr;
10003 ++itr;
10004
10005 // don't handle spells with proc_event entry defined
10006 // this is a temporary workaround, because all spellmods should be handled like that
10007 if (sSpellMgr->GetSpellProcEvent(mod->spellId))
10008 {
10009 continue;
10010 }
10011
10012 // spellmods without aura set cannot be charged
10013 if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges())
10014 continue;
10015
10016 // check if mod affected this spell
10017 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
10018 if (iterMod == spell->m_appliedMods.end())
10019 continue;
10020
10021 // remove from list
10022 // leave this here, if spell have two mods it will remove 2 charges - wrong
10023 spell->m_appliedMods.erase(iterMod);
10024
10025 // MAGE T8P4 BONUS
10026 if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE)
10027 {
10028 SpellInfo const* sp = mod->ownerAura->GetSpellInfo();
10029 // Missile Barrage, Hot Streak, Brain Freeze (trigger spell - Fireball!)
10030 if (sp->SpellIconID == 3261 || sp->SpellIconID == 2999 || sp->SpellIconID == 2938)
10031 if (AuraEffect* aurEff = GetAuraEffectDummy(64869))
10032 if (roll_chance_i(aurEff->GetAmount()))
10033 {
10034 mod->charges = 1;
10035 continue;
10036 }
10037 }
10038 // ROGUE MUTILATE WITH COLD BLOOD
10039 if (spellInfo->Id == 5374)
10040 {
10041 SpellInfo const* sp = mod->ownerAura->GetSpellInfo();
10042 if (sp->Id == 14177) // Cold Blood
10043 {
10044 mod->charges = 1;
10045 continue;
10046 }
10047 }
10048
10050 itr = m_spellMods[i].begin();
10051 }
10052 }
10053}
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3786
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
#define MAX_SPELLMOD
Definition SpellDefines.h:109
bool IsUsingCharges() const
Definition SpellAuras.h:200
bool DropCharge(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.h:146
uint32 SpellIconID
Definition SpellInfo.h:380
SpellInfo const *const m_spellInfo
Definition Spell.h:523
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5606

References AURA_REMOVE_BY_EXPIRE, SpellModifier::charges, Aura::DropCharge(), Unit::GetAuraEffectDummy(), Aura::GetSpellInfo(), SpellInfo::Id, Aura::IsUsingCharges(), Spell::m_appliedMods, Spell::m_spellInfo, m_spellMods, MAX_SPELLMOD, SpellModifier::ownerAura, roll_chance_i(), SPELLFAMILY_MAGE, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SpellModifier::spellId, and sSpellMgr.

Referenced by Spell::_cast().

◆ RemoveTimedAchievement()

void Player::RemoveTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)
13898{
13900}
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition AchievementMgr.cpp:2244

References m_achievementMgr, and AchievementMgr::RemoveTimedAchievement().

Referenced by InstanceScript::DoStopTimedAchievement(), and WorldSession::HandleQuestLogRemoveQuest().

◆ RemoveTimedQuest()

void Player::RemoveTimedQuest ( uint32  quest_id)
inline
1571{ m_timedquests.erase(quest_id); }

References m_timedquests.

Referenced by FailQuest(), WorldSession::HandleQuestLogRemoveQuest(), and RewardQuest().

◆ RemoveTradeableItem()

◆ ReplaceAllPlayerFlags()

void Player::ReplaceAllPlayerFlags ( PlayerFlags  flags)
inline
1130{ SetUInt32Value(PLAYER_FLAGS, flags); }

References PLAYER_FLAGS, and Unit::SetUInt32Value().

Referenced by LoadFromDB().

◆ RepopAtGraveyard()

void Player::RepopAtGraveyard ( )
4953{
4954 // note: this can be called also when the player is alive
4955 // for example from WorldSession::HandleMovementOpcodes
4956
4957 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
4958
4959 if (!sScriptMgr->OnPlayerCanRepopAtGraveyard(this))
4960 return;
4961
4962 // Such zones are considered unreachable as a ghost and the player must be automatically revived
4963 // Xinef: Get Transport Check is not needed
4964 if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) /*|| GetTransport()*/ || GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
4965 {
4966 ResurrectPlayer(0.5f);
4968 }
4969
4970 GraveyardStruct const* ClosestGrave = nullptr;
4971
4972 // Special handle for battleground maps
4973 if (Battleground* bg = GetBattleground())
4974 ClosestGrave = bg->GetClosestGraveyard(this);
4975 else
4976 {
4977 if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
4978 ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveyard(this);
4979 else
4980 ClosestGrave = sGraveyard->GetClosestGraveyard(this, GetTeamId());
4981 }
4982
4983 // stop countdown until repop
4984 m_deathTimer = 0;
4985
4986 // if no grave found, stay at the current location
4987 // and don't show spirit healer location
4988 if (ClosestGrave)
4989 {
4990 TeleportTo(ClosestGrave->Map, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
4991 if (isDead()) // not send if alive, because it used in TeleportTo()
4992 {
4993 WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // show spirit healer position on minimap
4994 data << ClosestGrave->Map;
4995 data << ClosestGrave->x;
4996 data << ClosestGrave->y;
4997 data << ClosestGrave->z;
4998 GetSession()->SendPacket(&data);
4999 }
5000 }
5001 else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
5003
5005}
@ AREA_FLAG_NEED_FLY
Definition DBCEnums.h:246
#define sGraveyard
Definition GameGraveyard.h:74
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition Player.h:494
@ SMSG_DEATH_RELEASE_LOC
Definition Opcodes.h:918
Definition GameGraveyard.h:27
float z
Definition GameGraveyard.h:32
float x
Definition GameGraveyard.h:30
float y
Definition GameGraveyard.h:31
uint32 Map
Definition GameGraveyard.h:29

References AREA_FLAG_NEED_FLY, AreaTableEntry::flags, WorldObject::GetAreaId(), GetBattleground(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), GetTeamId(), WorldObject::GetZoneId(), Unit::IsAlive(), Unit::isDead(), m_deathTimer, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GraveyardStruct::Map, PLAYER_FLAGS_IS_OUT_OF_BOUNDS, RemovePlayerFlag(), ResurrectPlayer(), sAreaTableStore, sBattlefieldMgr, WorldSession::SendPacket(), sGraveyard, SMSG_DEATH_RELEASE_LOC, SpawnCorpseBones(), sScriptMgr, TeleportTo(), GraveyardStruct::x, GraveyardStruct::y, and GraveyardStruct::z.

Referenced by Spell::EffectStuck(), HandleDrowning(), WorldSession::HandleInstanceLockResponse(), WorldSession::HandleRepopRequestOpcode(), misc_commandscript::HandleUnstuckCommand(), WorldSession::LogoutPlayer(), RemovedInsignia(), TeleportTo(), Update(), and UpdateHomebindTime().

◆ ReportedAfkBy()

void Player::ReportedAfkBy ( Player reporter)

This player has been blamed to be inactive in a battleground.

11357{
11359 // Battleground also must be in progress!
11360 if (!bg || bg != reporter->GetBattleground() || GetTeamId() != reporter->GetTeamId() || bg->GetStatus() != STATUS_IN_PROGRESS)
11361 return;
11362
11363 // Xinef: 2 minutes startup + 2 minute of match
11365 return;
11366
11367 // check if player has 'Idle' or 'Inactive' debuff
11368 if (m_bgData.bgAfkReporter.find(reporter->GetGUID()) == m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
11369 {
11370 m_bgData.bgAfkReporter.insert(reporter->GetGUID());
11371 // by default 3 players have to complain to apply debuff
11372 if (m_bgData.bgAfkReporter.size() >= sWorld->getIntConfig(CONFIG_BATTLEGROUND_REPORT_AFK))
11373 {
11374 // cast 'Idle' spell
11375 CastSpell(this, 43680, true);
11376 m_bgData.bgAfkReporter.clear();
11377 }
11378 }
11379}
@ CONFIG_BATTLEGROUND_REPORT_AFK_TIMER
Definition WorldConfig.h:263
@ CONFIG_BATTLEGROUND_REPORT_AFK
Definition WorldConfig.h:264
uint32 GetStartTime() const
Definition Battleground.h:325
bool CanReportAfkDueToLimit()
Definition Player.cpp:11346

References BGData::bgAfkReporter, CanReportAfkDueToLimit(), Unit::CastSpell(), CONFIG_BATTLEGROUND_REPORT_AFK, CONFIG_BATTLEGROUND_REPORT_AFK_TIMER, GetBattleground(), Object::GetGUID(), Battleground::GetStartTime(), Battleground::GetStatus(), GetTeamId(), Unit::HasAura(), IN_MILLISECONDS, m_bgData, MINUTE, STATUS_IN_PROGRESS, and sWorld.

Referenced by WorldSession::HandleReportPvPAFK().

◆ ReputationChanged()

void Player::ReputationChanged ( FactionEntry const *  factionEntry)
2209{
2210 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2211 {
2212 if (uint32 questid = GetQuestSlotQuestId(i))
2213 {
2214 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2215 {
2216 if (qInfo->GetRepObjectiveFaction() == factionEntry->ID)
2217 {
2218 QuestStatusData& q_status = m_QuestStatus[questid];
2219 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2220 {
2221 if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue())
2222 if (CanCompleteQuest(questid))
2223 CompleteQuest(questid);
2224 }
2225 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2226 {
2227 if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue())
2228 IncompleteQuest(questid);
2229 }
2230 }
2231 }
2232 }
2233 }
2234}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), GetReputation(), GetReputationMgr(), FactionEntry::ID, IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by ReputationMgr::SetOneFactionReputation().

◆ ReputationChanged2()

void Player::ReputationChanged2 ( FactionEntry const *  factionEntry)
2237{
2238 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2239 {
2240 if (uint32 questid = GetQuestSlotQuestId(i))
2241 {
2242 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2243 {
2244 if (qInfo->GetRepObjectiveFaction2() == factionEntry->ID)
2245 {
2246 QuestStatusData& q_status = m_QuestStatus[questid];
2247 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2248 {
2249 if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue2())
2250 if (CanCompleteQuest(questid))
2251 CompleteQuest(questid);
2252 }
2253 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2254 {
2255 if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2())
2256 IncompleteQuest(questid);
2257 }
2258 }
2259 }
2260 }
2261 }
2262}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), GetReputation(), GetReputationMgr(), FactionEntry::ID, IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

◆ ResetAchievementCriteria()

void Player::ResetAchievementCriteria ( AchievementCriteriaCondition  condition,
uint32  value,
bool  evenIfCriteriaComplete = false 
)
13903{
13904 m_achievementMgr->ResetAchievementCriteria(condition, value, evenIfCriteriaComplete);
13905}
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
Definition AchievementMgr.cpp:516

References m_achievementMgr, and AchievementMgr::ResetAchievementCriteria().

Referenced by Battleground::AddPlayer(), spell_algalon_supermassive_fail::RecalculateDamage(), Battleground::RemovePlayerAtLeave(), and setDeathState().

◆ ResetAchievements()

void Player::ResetAchievements ( )
13878{
13880}
void Reset()
Definition AchievementMgr.cpp:492

References m_achievementMgr, and AchievementMgr::Reset().

Referenced by reset_commandscript::HandleResetAchievementsCommand().

◆ ResetAllPowers()

◆ ResetContestedPvP()

void Player::ResetContestedPvP ( )
inline
1884 {
1888 }
@ PLAYER_FLAGS_CONTESTED_PVP
Definition Player.h:488
@ UNIT_STATE_ATTACK_PLAYER
Definition UnitDefines.h:184
void ClearUnitState(uint32 f)
Definition Unit.h:692

References Unit::ClearUnitState(), m_contestedPvPTimer, PLAYER_FLAGS_CONTESTED_PVP, RemovePlayerFlag(), and UNIT_STATE_ATTACK_PLAYER.

Referenced by SetGameMaster(), SetIsSpectator(), and UpdateContestedPvP().

◆ ResetDailyQuestStatus()

void Player::ResetDailyQuestStatus ( )
12124{
12125 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12126 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
12127
12128 m_DFQuests.clear(); // Dungeon Finder Quests.
12129
12130 // DB data deleted in caller
12131 m_DailyQuestChanged = false;
12133}

References m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and Unit::SetUInt32Value().

◆ ResetFarSightDistance()

void Player::ResetFarSightDistance ( )
16243{
16244 _farSightDistance.reset();
16245}

References _farSightDistance.

Referenced by AuraEffect::HandleFarSight().

◆ ResetInstances()

void Player::ResetInstances ( ObjectGuid  guid,
uint8  method,
bool  isRaid 
)
static

Reset all solo instances and optionally send a message on success for each.

196{
197 switch (method)
198 {
200 {
202 if (!p || p->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL)
203 break;
204 std::vector<InstanceSave*> toUnbind;
205 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
206 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
207 {
208 InstanceSave* instanceSave = itr->second.save;
209 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
210 if (!entry || entry->IsRaid() || !instanceSave->CanReset())
211 {
212 continue;
213 }
214
215 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
216 if (!map || map->ToInstanceMap()->Reset(method))
217 {
218 p->SendResetInstanceSuccess(instanceSave->GetMapId());
219 toUnbind.push_back(instanceSave);
220 }
221 else
222 {
223 p->SendResetInstanceFailed(0, instanceSave->GetMapId());
224 }
225
226 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
227 }
228 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
229 {
230 sInstanceSaveMgr->UnbindAllFor(*itr);
231 }
232 }
233 break;
235 {
237 if (!p)
238 break;
239 std::vector<InstanceSave*> toUnbind;
240 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), p->GetDifficulty(isRaid));
241 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
242 {
243 InstanceSave* instanceSave = itr->second.save;
244 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
245 if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset())
246 {
247 continue;
248 }
249
250 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
251 if (!map || map->ToInstanceMap()->Reset(method))
252 {
253 p->SendResetInstanceSuccess(instanceSave->GetMapId());
254 toUnbind.push_back(instanceSave);
255 }
256 else
257 {
258 p->SendResetInstanceFailed(0, instanceSave->GetMapId());
259 }
260
261 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
262 }
263 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
264 sInstanceSaveMgr->UnbindAllFor(*itr);
265 }
266 break;
268 {
270 if (!p)
271 break;
272 for (uint8 d = 0; d < MAX_DIFFICULTY; ++d)
273 {
274 std::vector<InstanceSave*> toUnbind;
275 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), Difficulty(d));
276 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
277 {
278 if (itr->second.perm)
279 continue;
280 InstanceSave* instanceSave = itr->second.save;
281 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
282 if (!map || p->FindMap() != map)
283 {
284 //p->SendResetInstanceSuccess(instanceSave->GetMapId());
285 toUnbind.push_back(instanceSave);
286 }
287 //else
288 // p->SendResetInstanceFailed(0, instanceSave->GetMapId());
289
290 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
291 }
292 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
293 sInstanceSaveMgr->PlayerUnbindInstance(p->GetGUID(), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p);
294 }
295 }
296 break;
298 {
300 for (uint8 d = 0; d < MAX_DIFFICULTY; ++d)
301 {
302 std::vector<InstanceSave*> toUnbind;
303 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(guid, Difficulty(d));
304 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
305 {
306 if (itr->second.perm)
307 continue;
308 InstanceSave* instanceSave = itr->second.save;
309 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
310 if (!p || !map || p->FindMap() != map)
311 {
312 //p->SendResetInstanceSuccess(instanceSave->GetMapId());
313 toUnbind.push_back(instanceSave);
314 }
315 //else
316 // p->SendResetInstanceFailed(0, instanceSave->GetMapId());
317 }
318 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
319 sInstanceSaveMgr->PlayerUnbindInstance(guid, (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p);
320 }
321 }
322 break;
323 }
324}
#define MAX_DIFFICULTY
Definition DBCEnums.h:283
std::unordered_map< uint32, InstancePlayerBind > BoundInstancesMap
Definition InstanceSaveMgr.h:46
@ INSTANCE_RESET_GROUP_JOIN
Definition Map.h:610
@ INSTANCE_RESET_CHANGE_DIFFICULTY
Definition Map.h:608
@ INSTANCE_RESET_GROUP_LEAVE
Definition Map.h:611
@ INSTANCE_RESET_ALL
Definition Map.h:607
bool Reset(uint8 method, GuidList *globalSkipList=nullptr)
Definition Map.cpp:2073
uint32 GetMapId() const
Definition InstanceSaveMgr.h:62
bool CanReset() const
Definition InstanceSaveMgr.h:81
InstanceMap * ToInstanceMap()
Definition Map.h:372
void SendResetInstanceSuccess(uint32 MapId)
Definition PlayerMisc.cpp:326
void SendResetInstanceFailed(uint32 reason, uint32 MapId)
Definition PlayerMisc.cpp:333

References InstanceSave::CanReset(), DUNGEON_DIFFICULTY_NORMAL, ObjectAccessor::FindConnectedPlayer(), WorldObject::FindMap(), GetDifficulty(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN, INSTANCE_RESET_GROUP_LEAVE, MapEntry::IsRaid(), MAX_DIFFICULTY, InstanceMap::Reset(), SendResetInstanceFailed(), SendResetInstanceSuccess(), sInstanceSaveMgr, sMapMgr, sMapStore, and Map::ToInstanceMap().

Referenced by Group::AddMember(), Group::Disband(), WorldSession::HandleResetInstancesOpcode(), WorldSession::HandleSetDungeonDifficultyOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), and Group::RemoveMember().

◆ ResetMap()

void Player::ResetMap ( )
overridevirtual

Reimplemented from WorldObject.

14632{
14633 // this may be called during Map::Update
14634 // after decrement+unlink, ++m_mapRefIter will continue correctly
14635 // when the first element of the list is being removed
14636 // nocheck_prev will return the padding element of the RefMgr
14637 // instead of nullptr in the case of prev
14638 GetMap()->UpdateIteratorBack(this);
14640 GetMapRef().unlink();
14641}
void UpdateIteratorBack(Player *player)
Definition Map.cpp:2311
MapReference & GetMapRef()
Definition Player.h:2508
virtual void ResetMap()
Definition Object.cpp:2096

References WorldObject::GetMap(), GetMapRef(), WorldObject::ResetMap(), Reference< TO, FROM >::unlink(), and Map::UpdateIteratorBack().

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::HandleSetRaidDifficultyOpcode().

◆ ResetMonthlyQuestStatus()

void Player::ResetMonthlyQuestStatus ( )
12156{
12157 if (m_monthlyquests.empty())
12158 return;
12159
12160 m_monthlyquests.clear();
12161 // DB data deleted in caller
12162 m_MonthlyQuestChanged = false;
12163}

References m_MonthlyQuestChanged, and m_monthlyquests.

◆ ResetPetTalents()

void Player::ResetPetTalents ( )
8918{
8919 // This needs another gossip option + NPC text as a confirmation.
8920 // The confirmation gossip listid has the text: "Yes, please do."
8921 Pet* pet = GetPet();
8922
8923 if (!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
8924 return;
8925
8926 CharmInfo* charmInfo = pet->GetCharmInfo();
8927 if (!charmInfo)
8928 {
8929 LOG_ERROR("entities.player", "Object ({}) is considered pet-like but doesn't have a charminfo!", pet->GetGUID().ToString());
8930 return;
8931 }
8932 pet->resetTalents();
8933 SendTalentsInfoData(true);
8934}
uint32 m_usedTalentCount
Definition Pet.h:134
bool resetTalents()
Definition Pet.cpp:2063

References Unit::GetCharmInfo(), Object::GetGUID(), GetPet(), Pet::getPetType(), HUNTER_PET, LOG_ERROR, Pet::m_usedTalentCount, Pet::resetTalents(), SendTalentsInfoData(), and ObjectGuid::ToString().

Referenced by OnGossipSelect(), and npc_pet_trainer::npc_pet_trainerAI::sGossipSelect().

◆ ResetSeasonalQuestStatus()

void Player::ResetSeasonalQuestStatus ( uint16  event_id)
12146{
12147 if (m_seasonalquests.empty() || m_seasonalquests[event_id].empty())
12148 return;
12149
12150 m_seasonalquests.erase(event_id);
12151 // DB data deleted in caller
12152 m_SeasonalQuestChanged = false;
12153}

References m_SeasonalQuestChanged, and m_seasonalquests.

◆ resetSpells()

void Player::resetSpells ( )
11789{
11790 // not need after this call
11793
11794 // make full copy of map (spells removed and marked as deleted at another spell remove
11795 // and we can't use original map for safe iterative with visit each spell at loop end
11796 PlayerSpellMap spellMap = GetSpellMap();
11797
11798 for (PlayerSpellMap::const_iterator iter = spellMap.begin(); iter != spellMap.end(); ++iter)
11799 removeSpell(iter->first, SPEC_MASK_ALL, false);
11800
11804}
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition Player.h:194
@ AT_LOGIN_RESET_SPELLS
Definition Player.h:608
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1786

References AT_LOGIN_RESET_SPELLS, GetSpellMap(), HasAtLoginFlag(), LearnCustomSpells(), LearnDefaultSkills(), learnQuestRewardedSpells(), RemoveAtLoginFlag(), removeSpell(), and SPEC_MASK_ALL.

Referenced by WorldSession::HandlePlayerLoginFromDB(), and reset_commandscript::HandleResetSpellsCommand().

◆ resetTalents()

bool Player::resetTalents ( bool  noResetCost = false)
3730{
3731 sScriptMgr->OnPlayerTalentsReset(this, noResetCost);
3732
3733 // xinef: remove at login flag upon talents reset
3736
3737 // xinef: get max available talent points amount
3738 uint32 talentPointsForLevel = CalculateTalentsPoints();
3739
3740 // xinef: no talent points are used, return
3741 if (m_usedTalentCount == 0)
3742 return false;
3744
3745 // xinef: check if we have enough money
3746 uint32 resetCost = 0;
3747 if (!noResetCost && !sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST))
3748 {
3749 resetCost = resetTalentsCost();
3750 if (!HasEnoughMoney(resetCost))
3751 {
3753 return false;
3754 }
3755 }
3756
3757 RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
3758
3759 // xinef: reset talents
3760 for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); )
3761 {
3762 PlayerTalentMap::iterator itr = iter++;
3763
3764 if (itr->second->State == PLAYERSPELL_REMOVED)
3765 continue;
3766
3767 // xinef: talent not in current spec
3768 if (!(itr->second->specMask & GetActiveSpecMask()))
3769 continue;
3770
3771 // xinef: remove talent auras
3772 _removeTalentAurasAndSpells(itr->first);
3773
3774 // xinef: check if talent learns spell to spell book
3775 TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID);
3776 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
3777
3778 bool removed = false;
3779 if (talentInfo->addToSpellBook)
3780 if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3781 {
3782 removeSpell(itr->first, GetActiveSpecMask(), false);
3783 removed = true;
3784 }
3785
3786 // Xinef: send unlearn spell packet at talent remove
3787 if (!removed)
3788 SendLearnPacket(itr->first, false);
3789
3790 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3791 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
3792 if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
3793 removeSpell(spellInfo->Effects[i].TriggerSpell, GetActiveSpecMask(), false);
3794
3795 // xinef: remove talent modifies m_talents, move itr to map begin
3797 }
3798
3799 // xinef: remove titan grip if player had it set
3800 if (m_canTitanGrip)
3801 SetCanTitanGrip(false);
3802 // xinef: remove dual wield if player does not have dual wield spell (shamans)
3803 if (!HasSpell(674) && m_canDualWield)
3804 SetCanDualWield(false);
3805
3807
3808 // pussywizard: removed saving to db, nothing important happens and saving only spells and talents may cause data integrity problems (eg. with skills saved to db)
3809 SetFreeTalentPoints(talentPointsForLevel);
3810
3811 if (!noResetCost)
3812 {
3813 ModifyMoney(-(int32)resetCost);
3816
3817 m_resetTalentsCost = resetCost;
3819 }
3820
3821 return true;
3822}
@ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS
Definition DBCEnums.h:173
@ ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS
Definition DBCEnums.h:174
@ AT_LOGIN_RESET_TALENTS
Definition Player.h:609
@ CONFIG_NO_RESET_TALENT_COST
Definition WorldConfig.h:88
uint32 resetTalentsCost() const
Definition Player.cpp:3696

References _removeTalent(), _removeTalentAurasAndSpells(), ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS, ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, TalentEntry::addToSpellBook, AT_LOGIN_RESET_TALENTS, AutoUnequipOffhandIfNeed(), BUY_ERR_NOT_ENOUGHT_MONEY, CalculateTalentsPoints(), CONFIG_NO_RESET_TALENT_COST, SpellInfo::Effects, GetActiveSpecMask(), GameTime::GetGameTime(), HasAtLoginFlag(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), HasEnoughMoney(), HasSpell(), Unit::m_canDualWield, m_canTitanGrip, m_resetTalentsCost, m_resetTalentsTime, m_talents, m_usedTalentCount, MAX_SPELL_EFFECTS, ModifyMoney(), PET_SAVE_NOT_IN_SLOT, PLAYERSPELL_REMOVED, RemoveAtLoginFlag(), RemovePet(), removeSpell(), resetTalentsCost(), SendBuyError(), SendLearnPacket(), Unit::SetCanDualWield(), SetCanTitanGrip(), SetFreeTalentPoints(), SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, sTalentStore, sWorld, and UpdateAchievementCriteria().

Referenced by WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetTalentsCommand(), WorldSession::HandleTalentWipeConfirmOpcode(), and InitTalentForLevel().

◆ resetTalentsCost()

uint32 Player::resetTalentsCost ( ) const
3697{
3698 // The first time reset costs 1 gold
3699 if (m_resetTalentsCost < 1 * GOLD)
3700 return 1 * GOLD;
3701 // then 5 gold
3702 else if (m_resetTalentsCost < 5 * GOLD)
3703 return 5 * GOLD;
3704 // After that it increases in increments of 5 gold
3705 else if (m_resetTalentsCost < 10 * GOLD)
3706 return 10 * GOLD;
3707 else
3708 {
3709 uint64 months = (GameTime::GetGameTime().count() - m_resetTalentsTime) / MONTH;
3710 if (months > 0)
3711 {
3712 // This cost will be reduced by a rate of 5 gold per month
3713 int32 new_cost = int32(m_resetTalentsCost - 5 * GOLD * months);
3714 // to a minimum of 10 gold.
3715 return (new_cost < 10 * GOLD ? 10 * GOLD : new_cost);
3716 }
3717 else
3718 {
3719 // After that it increases in increments of 5 gold
3720 int32 new_cost = m_resetTalentsCost + 5 * GOLD;
3721 // until it hits a cap of 50 gold.
3722 if (new_cost > 50 * GOLD)
3723 new_cost = 50 * GOLD;
3724 return new_cost;
3725 }
3726 }
3727}
constexpr auto MONTH
Definition Common.h:51
@ GOLD
Definition SharedDefines.h:253

References GameTime::GetGameTime(), GOLD, m_resetTalentsCost, m_resetTalentsTime, and MONTH.

Referenced by resetTalents(), and SendTalentWipeConfirm().

◆ ResetWeeklyQuestStatus()

void Player::ResetWeeklyQuestStatus ( )
12136{
12137 if (m_weeklyquests.empty())
12138 return;
12139
12140 m_weeklyquests.clear();
12141 // DB data deleted in caller
12142 m_WeeklyQuestChanged = false;
12143}

References m_WeeklyQuestChanged, and m_weeklyquests.

◆ RestoreAllSpellMods()

void Player::RestoreAllSpellMods ( uint32  ownerAuraId = 0,
Aura aura = nullptr 
)
9982{
9983 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
9984 if (m_currentSpells[i])
9985 RestoreSpellMods(m_currentSpells[i], ownerAuraId, aura);
9986}
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition Player.cpp:9914
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition Unit.h:2078

References CURRENT_MAX_SPELL, Unit::m_currentSpells, and RestoreSpellMods().

◆ RestoreBaseRune()

void Player::RestoreBaseRune ( uint8  index)
13365{
13366 AuraEffect const* aura = m_runes->runes[index].ConvertAura;
13367 // If rune was converted by a non-pasive aura that still active we should keep it converted
13368 if (aura && !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_PASSIVE))
13369 return;
13370 ConvertRune(index, GetBaseRune(index));
13371 SetRuneConvertAura(index, nullptr);
13372 // Don't drop passive talents providing rune convertion
13373 if (!aura || aura->GetAuraType() != SPELL_AURA_CONVERT_RUNE)
13374 return;
13375 for (uint8 i = 0; i < MAX_RUNES; ++i)
13376 {
13377 if (aura == m_runes->runes[i].ConvertAura)
13378 return;
13379 }
13380 aura->GetBase()->Remove();
13381}
@ SPELL_AURA_CONVERT_RUNE
Definition SpellAuraDefines.h:312
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:448
Aura * GetBase() const
Definition SpellAuraEffects.h:49

References RuneInfo::ConvertAura, ConvertRune(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), GetBaseRune(), AuraEffect::GetSpellInfo(), SpellInfo::HasAttribute(), m_runes, MAX_RUNES, Aura::Remove(), Runes::runes, SetRuneConvertAura(), SPELL_ATTR0_PASSIVE, and SPELL_AURA_CONVERT_RUNE.

Referenced by Spell::TakeRunePower().

◆ RestoreHealthAfterDuel()

void Player::RestoreHealthAfterDuel ( )
inline
uint32 healthBeforeDuel
Definition Player.h:3015

References healthBeforeDuel, and Unit::SetHealth().

◆ RestoreManaAfterDuel()

void Player::RestoreManaAfterDuel ( )
inline
uint32 manaBeforeDuel
Definition Player.h:3016

References manaBeforeDuel, POWER_MANA, and Unit::SetPower().

◆ RestoreSpellMods()

void Player::RestoreSpellMods ( Spell spell,
uint32  ownerAuraId = 0,
Aura aura = nullptr 
)
Todo:
track these changes correctly
9915{
9916 if (!spell || spell->m_appliedMods.empty())
9917 return;
9918
9919 std::list<Aura*> aurasQueue;
9920
9921 for (uint8 i = 0; i < MAX_SPELLMOD; ++i)
9922 {
9923 for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end(); ++itr)
9924 {
9925 SpellModifier* mod = *itr;
9926
9927 // Spellmods without aura set cannot be charged
9928 if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges())
9929 continue;
9930
9931 // Restore only specific owner aura mods
9932 if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellInfo()->Id))
9933 continue;
9934
9935 if (aura && mod->ownerAura != aura)
9936 continue;
9937
9938 // Check if mod affected this spell
9939 // First, check if the mod aura applied at least one spellmod to this spell
9940 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
9941 if (iterMod == spell->m_appliedMods.end())
9942 continue;
9943 // Second, check if the current mod is one of those applied by the mod aura
9944 if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags))
9945 continue;
9946
9947 // remove from list - This will be done after all mods have been gone through
9948 // to ensure we iterate over all mods of an aura before removing said aura
9949 // from applied mods (Else, an aura with two mods on the current spell would
9950 // only see the first of its modifier restored)
9951 aurasQueue.push_back(mod->ownerAura);
9952
9953 // add mod charges back to mod
9954 if (mod->charges == -1)
9955 mod->charges = 1;
9956 else
9957 mod->charges++;
9958
9959 // Do not set more spellmods than available
9960 if (mod->ownerAura->GetCharges() < mod->charges)
9961 mod->charges = mod->ownerAura->GetCharges();
9962
9963 // Skip this check for now - aura charges may change due to various reason
9965 //ASSERT (mod->ownerAura->GetCharges() <= mod->charges);
9966 }
9967 }
9968
9969 for (std::list<Aura*>::iterator itr = aurasQueue.begin(); itr != aurasQueue.end(); ++itr)
9970 {
9971 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(*itr);
9972 if (iterMod != spell->m_appliedMods.end())
9973 spell->m_appliedMods.erase(iterMod);
9974 }
9975
9976 // Xinef: clear the list just do be sure
9977 if (!ownerAuraId && !aura)
9978 spell->m_appliedMods.clear();
9979}
uint8 GetCharges() const
Definition SpellAuras.h:141
flag96 SpellFamilyFlags
Definition SpellInfo.h:388

References SpellModifier::charges, Aura::GetCharges(), Aura::GetSpellInfo(), SpellInfo::Id, Aura::IsUsingCharges(), Spell::m_appliedMods, Spell::m_spellInfo, m_spellMods, SpellModifier::mask, MAX_SPELLMOD, SpellModifier::ownerAura, and SpellInfo::SpellFamilyFlags.

Referenced by Spell::DoAllEffectOnTarget(), Spell::finish(), Unit::HandleDummyAuraProc(), and RestoreAllSpellMods().

◆ ResummonPetTemporaryUnSummonedIfAny()

void Player::ResummonPetTemporaryUnSummonedIfAny ( )
14202{
14204 return;
14205
14206 // not resummon in not appropriate state
14208 return;
14209
14210 if (GetPetGUID())
14211 return;
14212
14214 return;
14215
14216 Pet* newPet = new Pet(this);
14217 if (!newPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
14218 delete newPet;
14219
14221}
bool IsPetNeedBeTemporaryUnsummoned() const
Definition Player.h:2434
uint32 GetLastPetSpell() const
Definition Player.h:2476
bool CanResummonPet(uint32 spellid)
Definition Player.cpp:14223

References CanResummonPet(), GetLastPetSpell(), Unit::GetPetGUID(), IsPetNeedBeTemporaryUnsummoned(), IsSpectator(), Pet::LoadPetFromDB(), and m_temporaryUnsummonedPetNumber.

Referenced by Unit::_ExitVehicle(), WorldSession::HandleMoveTeleportAck(), and WorldSession::HandleMoveWorldportAck().

◆ ResurectUsingRequestData()

void Player::ResurectUsingRequestData ( )

Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse

12792{
12795
12796 if (IsBeingTeleported())
12797 {
12799 return;
12800 }
12801
12802 ResurrectPlayer(0.0f, false);
12803
12806 else
12807 SetFullHealth();
12808
12811 else
12813
12814 SetPower(POWER_RAGE, 0);
12815
12817
12819}
void ScheduleDelayedOperation(uint32 operation)
Definition Player.h:2117
float m_resurrectZ
Definition Player.h:2861
uint32 m_resurrectMap
Definition Player.h:2860
float m_resurrectX
Definition Player.h:2861
float m_resurrectY
Definition Player.h:2861

References DELAYED_RESURRECT_PLAYER, Unit::GetMaxHealth(), Unit::GetMaxPower(), Position::GetOrientation(), IsBeingTeleported(), m_resurrectHealth, m_resurrectMana, m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, POWER_ENERGY, POWER_MANA, POWER_RAGE, ResurrectPlayer(), ScheduleDelayedOperation(), Unit::SetFullHealth(), Unit::SetHealth(), Unit::SetPower(), SpawnCorpseBones(), and TeleportTo().

Referenced by WorldSession::HandleResurrectResponseOpcode().

◆ ResurrectPlayer()

void Player::ResurrectPlayer ( float  restore_percent,
bool  applySickness = false 
)
4505{
4506 if (!sScriptMgr->OnPlayerCanResurrect(this))
4507 return;
4508
4509 WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // remove spirit healer position
4510 data << uint32(-1);
4511 data << float(0);
4512 data << float(0);
4513 data << float(0);
4514 GetSession()->SendPacket(&data);
4515
4516 // speed change, land walk
4517
4518 // remove death flag + set aura
4520 RemoveAurasDueToSpell(20584); // speed bonuses
4521 RemoveAurasDueToSpell(8326); // SPELL_AURA_GHOST
4522
4523 if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
4525
4529 SetWaterWalking(false);
4530 m_deathTimer = 0;
4531
4532 // set health/powers (0- will be set in caller)
4533 if (restore_percent > 0.0f)
4534 {
4535 SetHealth(uint32(GetMaxHealth()*restore_percent));
4536 SetPower(POWER_MANA, uint32(GetMaxPower(POWER_MANA)*restore_percent));
4537 SetPower(POWER_RAGE, 0);
4539 }
4540
4541 // trigger update zone for alive state zone updates
4542 uint32 newzone, newarea;
4543 GetZoneAndAreaId(newzone, newarea);
4544 UpdateZone(newzone, newarea, true);
4545 sOutdoorPvPMgr->HandlePlayerResurrects(this, newzone);
4546
4547 if (Battleground* bg = GetBattleground())
4548 bg->HandlePlayerResurrect(this);
4549
4550 // update visibility
4552
4553 sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
4554
4555 if (!applySickness)
4556 {
4557 return;
4558 }
4559
4560 //Characters from level 1-10 are not affected by resurrection sickness.
4561 //Characters from level 11-19 will suffer from one minute of sickness
4562 //for each level they are above 10.
4563 //Characters level 20 and up suffer from ten minutes of sickness.
4564 int32 startLevel = sWorld->getIntConfig(CONFIG_DEATH_SICKNESS_LEVEL);
4565
4566 if (int32(GetLevel()) >= startLevel)
4567 {
4568 // set resurrection sickness
4569 CastSpell(this, 15007, true);
4570
4571 // not full duration
4572 if (int32(GetLevel()) < startLevel + 9)
4573 {
4574 int32 delta = (int32(GetLevel()) - startLevel + 1) * MINUTE;
4575
4576 if (Aura* aur = GetAura(15007, GetGUID()))
4577 {
4578 aur->SetDuration(delta * IN_MILLISECONDS);
4579 }
4580 }
4581 }
4582}
@ MOVE_LAND_WALK
Definition Player.h:465
@ UNIT_BYTE1_FLAG_GROUND
Definition UnitDefines.h:58
@ CONFIG_DEATH_SICKNESS_LEVEL
Definition WorldConfig.h:254
void UpdateZone(uint32 newZone, uint32 newArea, bool force=false)
Definition PlayerUpdates.cpp:1252
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition PlayerUpdates.cpp:1617
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition Object.cpp:3037

References Alive, Unit::CastSpell(), CONFIG_DEATH_SICKNESS_LEVEL, Unit::GetAura(), GetBattleground(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), GetSession(), WorldObject::GetZoneAndAreaId(), IN_MILLISECONDS, m_deathTimer, MINUTE, MOVE_LAND_WALK, MOVE_UNROOT, POWER_ENERGY, POWER_MANA, POWER_RAGE, Unit::RemoveAurasDueToSpell(), WorldSession::SendPacket(), Object::SetByteValue(), setDeathState(), Object::SetDynamicFlag(), Unit::SetHealth(), SetMovement(), Unit::SetPower(), SetWaterWalking(), SMSG_DEATH_RELEASE_LOC, sOutdoorPvPMgr, sScriptMgr, sWorld, UNIT_BYTE1_FLAG_GROUND, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_DYNFLAG_REFER_A_FRIEND, UNIT_FIELD_BYTES_1, UpdateObjectVisibility(), and UpdateZone().

Referenced by Battleground::_ProcessResurrect(), Spell::EffectSelfResurrect(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleBattleFieldPortOpcode(), group_commandscript::HandleGroupReviveCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleReclaimCorpseOpcode(), LoadCorpse(), LoadFromDB(), ProcessDelayedOperations(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), ResurectUsingRequestData(), BfGraveyard::Resurrect(), and WorldSession::SendSpiritResurrect().

◆ ResyncRunes()

void Player::ResyncRunes ( uint8  count)
13394{
13395 WorldPacket data(SMSG_RESYNC_RUNES, 4 + count * 2);
13396 data << uint32(count);
13397 for (uint32 i = 0; i < count; ++i)
13398 {
13399 data << uint8(GetCurrentRune(i)); // rune type
13400 data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
13401 }
13402 GetSession()->SendPacket(&data);
13403}
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2524
@ SMSG_RESYNC_RUNES
Definition Opcodes.h:1189

References GetCurrentRune(), GetRuneCooldown(), GetSession(), WorldSession::SendPacket(), and SMSG_RESYNC_RUNES.

◆ RewardExtraBonusTalentPoints()

void Player::RewardExtraBonusTalentPoints ( uint32  bonusTalentPoints)

A talent point boost. Usage: 1). Hot update situation (occurred when character is online, like PlayerScript:OnAchiComplete): Right after calling this function, character can reward talent points by calling function player->InitTalentForLevel().

2). Data initing situation (like PlayerScript:OnLoadFromDB)

6087{
6088 if (bonusTalentPoints)
6089 {
6090 m_extraBonusTalentCount += bonusTalentPoints;
6091 }
6092}

References m_extraBonusTalentCount.

◆ RewardHonor()

bool Player::RewardHonor ( Unit uVictim,
uint32  groupsize,
int32  honor = -1,
bool  awardXP = true 
)

Calculate the amount of honor gained based on the victim and the size of the group for which the honor is divided An exact honor value can also be given (overriding the calcs)

6098{
6099 // do not reward honor in arenas, but enable onkill spellproc
6100 if (InArena())
6101 {
6102 if (!uVictim || uVictim == this || !uVictim->IsPlayer())
6103 return false;
6104
6105 if (GetBgTeamId() == uVictim->ToPlayer()->GetBgTeamId())
6106 return false;
6107
6108 return true;
6109 }
6110
6111 // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
6113 return false;
6114
6115 /* check if player has same IP
6116 if (uVictim && uVictim->IsPlayer())
6117 {
6118 if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress())
6119 return false;
6120 }
6121 */
6122
6123 ObjectGuid victim_guid;
6124 uint32 victim_rank = 0;
6125
6126 // need call before fields update to have chance move yesterday data to appropriate fields before today data change.
6128
6129 // do not reward honor in arenas, but return true to enable onkill spellproc
6130 if (InArena())
6131 return true;
6132
6133 // Promote to float for calculations
6134 float honor_f = (float)honor;
6135
6136 if (honor_f <= 0)
6137 {
6138 if (!uVictim || uVictim == this || uVictim->HasNoPVPCreditAura())
6139 return false;
6140
6141 victim_guid = uVictim->GetGUID();
6142
6143 if (uVictim->IsPlayer())
6144 {
6145 Player* victim = uVictim->ToPlayer();
6146
6147 if (GetTeamId() == victim->GetTeamId() && !sWorld->IsFFAPvPRealm())
6148 return false;
6149
6150 uint8 k_level = GetLevel();
6151 uint8 k_grey = Acore::XP::GetGrayLevel(k_level);
6152 uint8 v_level = victim->GetLevel();
6153
6154 if (v_level <= k_grey)
6155 return false;
6156
6157 // PLAYER_CHOSEN_TITLE VALUES DESCRIPTION
6158 // [0] Just name
6159 // [1..14] Alliance honor titles and player name
6160 // [15..28] Horde honor titles and player name
6161 // [29..38] Other title and player name
6162 // [39+] Nothing
6163 uint32 victim_title = victim->GetUInt32Value(PLAYER_CHOSEN_TITLE);
6164 uint32 killer_title = 0;
6165 sScriptMgr->OnPlayerVictimRewardBefore(this, victim, killer_title, victim_title);
6166 // Get Killer titles, CharTitlesEntry::bit_index
6167 // Ranks:
6168 // title[1..14] -> rank[5..18]
6169 // title[15..28] -> rank[5..18]
6170 // title[other] -> 0
6171 if (victim_title == 0)
6172 victim_guid.Clear(); // Don't show HK: <rank> message, only log.
6173 else if (victim_title < 15)
6174 victim_rank = victim_title + 4;
6175 else if (victim_title < 29)
6176 victim_rank = victim_title - 14 + 4;
6177 else
6178 victim_guid.Clear(); // Don't show HK: <rank> message, only log.
6179
6180 honor_f = std::ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
6181
6182 // count the number of playerkills in one day
6184 // and those in a lifetime
6192 sScriptMgr->OnPlayerVictimRewardAfter(this, victim, killer_title, victim_rank, honor_f);
6193 }
6194 else
6195 {
6196 if (!uVictim->ToCreature()->IsRacialLeader())
6197 return false;
6198
6199 honor_f = 100.0f; // ??? need more info
6200 victim_rank = 19; // HK: Leader
6201 }
6202 }
6203
6204 if (uVictim)
6205 {
6206 if (groupsize > 1)
6207 honor_f /= groupsize;
6208
6209 // apply honor multiplier from aura (not stacking-get highest)
6211 }
6212
6213 honor_f *= sWorld->getRate(RATE_HONOR);
6214 // Back to int now
6215 honor = int32(honor_f);
6216 // honor - for show honor points in log
6217 // victim_guid - for show victim name in log
6218 // victim_rank [1..4] HK: <dishonored rank>
6219 // victim_rank [5..19] HK: <alliance\horde rank>
6220 // victim_rank [0, 20+] HK: <>
6221 WorldPacket data(SMSG_PVP_CREDIT, 4 + 8 + 4);
6222 data << honor;
6223 data << victim_guid;
6224 data << victim_rank;
6225
6226 // Xinef: non quest case, quest honor obtain is send in quest reward packet
6227 if (uVictim || groupsize > 0)
6228 GetSession()->SendPacket(&data);
6229
6230 // add honor points
6231 ModifyHonorPoints(honor);
6232
6234
6235 // Xinef: Battleground experience
6236 if (awardXP)
6237 if (Battleground* bg = GetBattleground())
6238 {
6239 bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping
6240 // Xinef: Only for BG activities
6241 if (!uVictim)
6242 {
6243 uint32 xp = uint32(honor * (3 + GetLevel() * 0.30f));
6244 sScriptMgr->OnPlayerGiveXP(this, xp, nullptr, PlayerXPSource::XPSOURCE_BATTLEGROUND);
6245 GiveXP(xp, nullptr);
6246 }
6247 }
6248
6249 if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))
6250 {
6251 if (!uVictim || uVictim == this || uVictim->HasNoPVPCreditAura())
6252 return true;
6253
6254 if (uVictim->IsPlayer())
6255 {
6256 // Check if allowed to receive it in current map
6258 if ((MapType == 1 && !InBattleground() && !IsFFAPvP())
6259 || (MapType == 2 && !IsFFAPvP())
6260 || (MapType == 3 && !InBattleground()))
6261 return true;
6262
6263 uint32 itemID = sWorld->getIntConfig(CONFIG_PVP_TOKEN_ID);
6264 int32 count = sWorld->getIntConfig(CONFIG_PVP_TOKEN_COUNT);
6265
6266 if (AddItem(itemID, count))
6267 ChatHandler(GetSession()).PSendSysMessage("You have been awarded a token for slaying another player.");
6268 }
6269 }
6270
6271 return true;
6272}
@ SCORE_BONUS_HONOR
Definition BattlegroundScore.h:31
@ SPELL_AURA_PLAYER_INACTIVE
Definition Battleground.h:136
@ ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL
Definition DBCEnums.h:219
@ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL
Definition DBCEnums.h:149
@ ACHIEVEMENT_CRITERIA_TYPE_HK_RACE
Definition DBCEnums.h:167
@ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA
Definition DBCEnums.h:145
@ ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL
Definition DBCEnums.h:182
@ ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS
Definition DBCEnums.h:166
@ XPSOURCE_BATTLEGROUND
Definition Player.h:1020
@ SPELL_AURA_MOD_HONOR_GAIN_PCT
Definition SpellAuraDefines.h:344
@ CONFIG_PVP_TOKEN_MAP_TYPE
Definition WorldConfig.h:291
@ CONFIG_PVP_TOKEN_ENABLE
Definition WorldConfig.h:87
@ CONFIG_PVP_TOKEN_ID
Definition WorldConfig.h:292
@ CONFIG_PVP_TOKEN_COUNT
Definition WorldConfig.h:293
@ RATE_HONOR
Definition WorldConfig.h:461
bool IsRacialLeader() const
Definition Creature.h:74
void Clear()
Definition ObjectGuid.h:138
bool AddItem(uint32 itemId, uint32 count)
Definition Player.cpp:15527
bool IsFFAPvP()
Definition Player.cpp:16187
TeamId GetBgTeamId() const
Definition Player.h:2296
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition Unit.cpp:6022
bool HasNoPVPCreditAura() const
Definition Unit.h:1724
@ SMSG_PVP_CREDIT
Definition Opcodes.h:682
float hk_honor_at_level_f(uint8 level, float multiplier=1.0f)
Definition Formulas.h:31
std::unordered_map< std::string, Player * > MapType
Definition ObjectAccessor.cpp:85

References ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, AddItem(), AddPct(), Object::ApplyModUInt32Value(), ObjectGuid::Clear(), CONFIG_PVP_TOKEN_COUNT, CONFIG_PVP_TOKEN_ENABLE, CONFIG_PVP_TOKEN_ID, CONFIG_PVP_TOKEN_MAP_TYPE, WorldObject::GetAreaId(), GetBattleground(), GetBgTeamId(), Unit::getClass(), Acore::XP::GetGrayLevel(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxPositiveAuraModifier(), Unit::getRace(), GetSession(), GetTeamId(), Object::GetUInt32Value(), GiveXP(), Unit::HasAura(), Unit::HasNoPVPCreditAura(), Acore::Honor::hk_honor_at_level_f(), InArena(), InBattleground(), IsFFAPvP(), Object::IsPlayer(), Creature::IsRacialLeader(), ModifyHonorPoints(), PLAYER_CHOSEN_TITLE, PLAYER_FIELD_KILLS, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, ChatHandler::PSendSysMessage(), RATE_HONOR, SCORE_BONUS_HONOR, WorldSession::SendPacket(), SMSG_PVP_CREDIT, SPELL_AURA_MOD_HONOR_GAIN_PCT, SPELL_AURA_PLAYER_INACTIVE, sScriptMgr, sWorld, Object::ToCreature(), Object::ToPlayer(), UpdateAchievementCriteria(), UpdateHonorFields(), and XPSOURCE_BATTLEGROUND.

Referenced by KillRewarder::_RewardHonor(), DuelComplete(), Spell::EffectAddHonor(), OutdoorPvPSI::HandleAreaTrigger(), honor_commandscript::HandleHonorAddCommand(), honor_commandscript::HandleHonorAddKillCommand(), RewardQuest(), and Battleground::UpdatePlayerScore().

◆ RewardPlayerAndGroupAtEvent()

void Player::RewardPlayerAndGroupAtEvent ( uint32  creature_id,
WorldObject pRewardSource 
)
12701{
12702 if (!pRewardSource)
12703 return;
12704
12705 ObjectGuid creature_guid = (pRewardSource->IsCreature()) ? pRewardSource->GetGUID() : ObjectGuid::Empty;
12706
12707 // prepare data for near group iteration
12708 if (Group* group = GetGroup())
12709 {
12710 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12711 {
12712 Player* player = itr->GetSource();
12713 if (!player)
12714 continue;
12715
12716 if (!player->IsAtGroupRewardDistance(pRewardSource))
12717 continue; // member (alive or dead) or his corpse at req. distance
12718
12719 // quest objectives updated only for alive group member or dead but with not released body
12720 if (player->IsAlive() || !player->GetCorpse())
12721 player->KilledMonsterCredit(creature_id, creature_guid);
12722 }
12723 }
12724 else // if (!group)
12725 KilledMonsterCredit(creature_id, creature_guid);
12726}
GroupReference * next()
Definition GroupReference.h:36

References ObjectGuid::Empty, GetCorpse(), GetGroup(), Object::GetGUID(), Unit::IsAlive(), IsAtGroupRewardDistance(), Object::IsCreature(), KilledMonsterCredit(), and GroupReference::next().

Referenced by Spell::EffectKillCredit(), spell_inoculate_nestlewood_owlkin::HandleEffectRemove(), SmartScript::ProcessAction(), and SmartAI::StopFollow().

◆ RewardPlayerAndGroupAtKill()

void Player::RewardPlayerAndGroupAtKill ( Unit victim,
bool  isBattleGround 
)
12696{
12697 KillRewarder(this, victim, isBattleGround).Reward();
12698}
Definition KillRewarder.h:28
void Reward()
Definition KillRewarder.cpp:268

References KillRewarder::Reward().

Referenced by Unit::Kill(), and Battleground::RewardXPAtKill().

◆ RewardQuest()

void Player::RewardQuest ( Quest const *  quest,
uint32  reward,
Object questGiver,
bool  announce = true,
bool  isLFGReward = false 
)
660{
661 //this THING should be here to protect code from quest, which cast on player far teleport as a reward
662 //should work fine, cause far teleport will be executed in Player::Update()
664
665 uint32 quest_id = quest->GetQuestId();
666
667 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
668 {
669 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
670 {
671 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->RequiredItemId[i], quest_id, true))
672 DestroyItemCount(quest->RequiredItemId[i], 9999, true);
673 else
674 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
675 }
676 }
677 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
678 {
679 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
680 {
681 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->ItemDrop[i], quest_id))
682 DestroyItemCount(quest->ItemDrop[i], 9999, true);
683 else
684 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
685 }
686 }
687
688 RemoveTimedQuest(quest_id);
689
690 std::vector<std::pair<uint32, uint32>> problematicItems;
691
692 if (quest->GetRewChoiceItemsCount())
693 {
694 if (uint32 itemId = quest->RewardChoiceItemId[reward])
695 {
696 ItemPosCountVec dest;
697 if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardChoiceItemCount[reward]) == EQUIP_ERR_OK)
698 {
699 Item* item = StoreNewItem(dest, itemId, true);
700 SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false, false, false);
701
702 sScriptMgr->OnPlayerQuestRewardItem(this, item, quest->RewardChoiceItemCount[reward]);
703 }
704 else
705 {
706 problematicItems.emplace_back(itemId, quest->RewardChoiceItemCount[reward]);
707 }
708 }
709 }
710
711 if (quest->GetRewItemsCount())
712 {
713 for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
714 {
715 if (uint32 itemId = quest->RewardItemId[i])
716 {
717 ItemPosCountVec dest;
718 if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK)
719 {
720 Item* item = StoreNewItem(dest, itemId, true);
721 SendNewItem(item, quest->RewardItemIdCount[i], true, false, false, false);
722
723 sScriptMgr->OnPlayerQuestRewardItem(this, item, quest->RewardItemIdCount[i]);
724 }
725 else
726 problematicItems.emplace_back(itemId, quest->RewardItemIdCount[i]);
727 }
728 }
729 }
730
731 // Xinef: send items that couldn't be added properly by mail
732 if (!problematicItems.empty())
733 {
734 SendItemRetrievalMail(problematicItems);
735 }
736
737 RewardReputation(quest);
738
739 uint16 log_slot = FindQuestSlot(quest_id);
740 if (log_slot < MAX_QUEST_LOG_SIZE)
741 SetQuestSlot(log_slot, 0);
742
743 bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
744
745 // Not give XP in case already completed once repeatable quest
746 uint32 XP = rewarded ? 0 : CalculateQuestRewardXP(quest);
747
748 sScriptMgr->OnPlayerQuestComputeXP(this, quest, XP);
749 int32 moneyRew = 0;
750 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(this))
751 {
752 moneyRew = quest->GetRewMoneyMaxLevel();
753 }
754 else
755 {
756 sScriptMgr->OnPlayerGiveXP(this, XP, nullptr, isLFGReward ? PlayerXPSource::XPSOURCE_QUEST_DF : PlayerXPSource::XPSOURCE_QUEST);
757 GiveXP(XP, nullptr, 1.0f, isLFGReward);
758 }
759
760 // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
761 if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(GetLevel()))
762 {
763 moneyRew += rewOrReqMoney;
764 }
765
766 if (moneyRew)
767 {
768 ModifyMoney(moneyRew);
769
770 if (moneyRew > 0)
772 }
773
774 // honor reward
775 if (uint32 honor = quest->CalculateHonorGain(GetLevel()))
776 RewardHonor(nullptr, 0, honor);
777
778 // title reward
779 if (quest->GetCharTitleId())
780 {
781 if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(quest->GetCharTitleId()))
782 SetTitle(titleEntry);
783 }
784
785 if (quest->GetBonusTalents())
786 {
787 m_questRewardTalentCount += quest->GetBonusTalents();
789 }
790
791 if (quest->GetRewArenaPoints())
792 ModifyArenaPoints(quest->GetRewArenaPoints());
793
794 // Send reward mail
795 if (uint32 mail_template_id = quest->GetRewMailTemplateId())
796 {
797 //- TODO: Poor design of mail system
798 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
799 if (quest->GetRewMailSenderEntry() != 0)
800 MailDraft(mail_template_id).SendMailTo(trans, this, quest->GetRewMailSenderEntry(), MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
801 else
802 MailDraft(mail_template_id).SendMailTo(trans, this, questGiver, MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
803 CharacterDatabase.CommitTransaction(trans);
804 }
805
806 if (quest->IsDaily() || quest->IsDFQuest())
807 {
808 SetDailyQuestStatus(quest_id);
809 if (quest->IsDaily())
810 {
813 }
814 }
815 else if (quest->IsWeekly())
816 SetWeeklyQuestStatus(quest_id);
817 else if (quest->IsMonthly())
818 SetMonthlyQuestStatus(quest_id);
819 else if (quest->IsSeasonal())
820 SetSeasonalQuestStatus(quest_id);
821
822 RemoveActiveQuest(quest_id, false);
823 SetRewardedQuest(quest_id);
824
825 if (announce)
826 SendQuestReward(quest, XP);
827
828 // cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data)
829 if (quest->GetRewSpellCast() > 0)
830 {
831 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast());
832 if (questGiver->IsUnit() && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast())
833 {
834 if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID()))
835 creature->CastSpell(this, quest->GetRewSpellCast(), true);
836 }
837 else
838 CastSpell(this, quest->GetRewSpellCast(), true);
839 }
840 else if (quest->GetRewSpell() > 0)
841 {
842 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpell());
843 if (questGiver->IsUnit() && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast())
844 {
845 if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID()))
846 creature->CastSpell(this, quest->GetRewSpell(), true);
847 }
848 else
849 CastSpell(this, quest->GetRewSpell(), true);
850 }
851
852 if (quest->GetZoneOrSort() > 0)
856
857 // pussywizard: replaced partial save with full save
858 SaveToDB(false, false);
859
860 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
861 {
864 }
865
866 SendQuestUpdate(quest_id);
867
869
870 //lets remove flag for delayed teleports
872
873 // Xinef: area auras may change on quest completion!
876
877 sScriptMgr->OnPlayerCompleteQuest(this, quest);
878}
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE
Definition DBCEnums.h:129
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY
Definition DBCEnums.h:128
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT
Definition DBCEnums.h:127
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST
Definition DBCEnums.h:131
@ ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD
Definition DBCEnums.h:175
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST
Definition DBCEnums.h:141
@ MAIL_CHECK_MASK_HAS_BODY
Definition Mail.h:51
PlayerXPSource
Definition Player.h:1015
@ XPSOURCE_QUEST
Definition Player.h:1017
@ XPSOURCE_QUEST_DF
Definition Player.h:1018
@ SPELL_EFFECT_CREATE_ITEM
Definition SharedDefines.h:802
bool IsUnit() const
Definition Object.h:209
bool HasPvPForcingQuest() const
Definition PlayerQuest.cpp:2495
bool HasQuestForItem(uint32 itemId, uint32 excludeQuestId=0, bool turnIn=false, bool *showInLoot=nullptr) const
Definition PlayerQuest.cpp:2264
uint32 CalculateQuestRewardXP(Quest const *quest)
Definition PlayerQuest.cpp:1402
void SetMonthlyQuestStatus(uint32 quest_id)
Definition Player.cpp:12117
void SetSeasonalQuestStatus(uint32 quest_id)
Definition Player.cpp:12107
void SendItemRetrievalMail(uint32 itemEntry, uint32 count)
Definition PlayerMisc.cpp:439
void SendQuestReward(Quest const *quest, uint32 XP)
Definition PlayerQuest.cpp:2357
void SetDailyQuestStatus(uint32 quest_id)
Definition Player.cpp:12059
void RewardReputation(Unit *victim)
Definition Player.cpp:5982
void SetRewardedQuest(uint32 quest_id)
Definition PlayerQuest.cpp:880
void SetWeeklyQuestStatus(uint32 quest_id)
Definition Player.cpp:12101
void RemoveActiveQuest(uint32 questId, bool update=true)
Definition PlayerQuest.cpp:1495
void SetMustDelayTeleport(bool setting)
Definition Player.h:2967
bool IsSelfCast() const
Definition SpellInfo.cpp:1090
bool IsInHostileArea
Definition Player.h:367

References ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, BIND_QUEST_ITEM, Quest::CalculateHonorGain(), CalculateQuestRewardXP(), CanStoreNewItem(), Unit::CastSpell(), CharacterDatabase, CONFIG_MAX_PLAYER_LEVEL, DestroyItemCount(), EQUIP_ERR_OK, FindQuestSlot(), WorldObject::GetAreaId(), Quest::GetBonusTalents(), Quest::GetCharTitleId(), Object::GetGUID(), Unit::GetLevel(), WorldObject::GetMap(), Quest::GetQuestId(), Quest::GetRewArenaPoints(), Quest::GetRewChoiceItemsCount(), Quest::GetRewItemsCount(), Quest::GetRewMailDelaySecs(), Quest::GetRewMailSenderEntry(), Quest::GetRewMailTemplateId(), Quest::GetRewMoneyMaxLevel(), Quest::GetRewOrReqMoney(), Quest::GetRewSpell(), Quest::GetRewSpellCast(), WorldObject::GetZoneId(), Quest::GetZoneOrSort(), GiveXP(), SpellInfo::HasEffect(), Quest::HasFlag(), HasPvPForcingQuest(), HasQuestForItem(), InitTalentForLevel(), Quest::IsDaily(), Quest::IsDFQuest(), PvPInfo::IsHostile, PvPInfo::IsInHostileArea, Quest::IsMonthly(), IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), SpellInfo::IsSelfCast(), Object::IsUnit(), Quest::IsWeekly(), Quest::ItemDrop, Quest::ItemDropQuantity, m_questRewardTalentCount, MAIL_CHECK_MASK_HAS_BODY, MAX_QUEST_LOG_SIZE, ModifyArenaPoints(), ModifyMoney(), NULL_BAG, NULL_SLOT, pvpInfo, QUEST_FLAGS_FLAGS_PVP, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, RemoveActiveQuest(), RemoveTimedQuest(), Quest::RequiredItemCount, Quest::RequiredItemId, Quest::RewardChoiceItemCount, Quest::RewardChoiceItemId, RewardHonor(), Quest::RewardItemId, Quest::RewardItemIdCount, RewardReputation(), SaveToDB(), sCharTitlesStore, SendItemRetrievalMail(), MailDraft::SendMailTo(), SendNewItem(), SendQuestGiverStatusMultiple(), SendQuestReward(), SendQuestUpdate(), SetDailyQuestStatus(), SetMonthlyQuestStatus(), SetMustDelayTeleport(), SetQuestSlot(), SetRewardedQuest(), SetSeasonalQuestStatus(), SetTitle(), SetWeeklyQuestStatus(), sObjectMgr, SPELL_EFFECT_CREATE_ITEM, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, StoreNewItem(), sWorld, UpdateAchievementCriteria(), UpdateAreaDependentAuras(), UpdatePvPState(), UpdateZoneDependentAuras(), XPSOURCE_QUEST, and XPSOURCE_QUEST_DF.

Referenced by CompleteQuest(), lfg::LFGMgr::FinishDungeon(), and WorldSession::HandleQuestgiverChooseRewardOpcode().

◆ RewardReputation() [1/2]

void Player::RewardReputation ( Quest const *  quest)
6033{
6034 for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
6035 {
6036 if (!quest->RewardFactionId[i])
6037 continue;
6038
6039 float rep = 0.f;
6040
6041 if (quest->RewardFactionValueIdOverride[i])
6042 {
6043 rep = quest->RewardFactionValueIdOverride[i] / 100.f;
6044 }
6045 else
6046 {
6047 uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
6048 if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
6049 {
6050 uint32 field = std::abs(quest->RewardFactionValueId[i]);
6051 rep = static_cast<float>(questFactionRewEntry->QuestRewFactionValue[field]);
6052 }
6053 }
6054
6055 if (rep == 0.f)
6056 continue;
6057
6058 if (quest->IsDaily())
6059 {
6060 rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
6061 }
6062 else if (quest->IsWeekly())
6063 {
6064 rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
6065 }
6066 else if (quest->IsMonthly())
6067 {
6068 rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
6069 }
6070 else if (quest->IsRepeatable())
6071 {
6072 rep = CalculateReputationGain(REPUTATION_SOURCE_REPEATABLE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
6073 }
6074 else
6075 {
6076 rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
6077 }
6078
6079 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
6080 {
6081 GetReputationMgr().ModifyReputation(factionEntry, rep, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
6082 }
6083 }
6084}
DBCStorage< QuestFactionRewEntry > sQuestFactionRewardStore(QuestFactionRewardfmt)
#define QUEST_REPUTATIONS_COUNT
Definition QuestDef.h:41
@ QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER
Definition QuestDef.h:166
float CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus=false)
Definition Player.cpp:5902
bool ModifyReputation(FactionEntry const *factionEntry, float standing, bool noSpillOver=false, Optional< ReputationRank > repMaxCap={})
Definition ReputationMgr.h:117
Definition DBCStructure.h:1459

References CalculateReputationGain(), GetQuestLevel(), GetReputationMgr(), Quest::HasSpecialFlag(), Quest::IsDaily(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), ReputationMgr::ModifyReputation(), QUEST_REPUTATIONS_COUNT, QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER, REPUTATION_SOURCE_DAILY_QUEST, REPUTATION_SOURCE_MONTHLY_QUEST, REPUTATION_SOURCE_QUEST, REPUTATION_SOURCE_REPEATABLE_QUEST, REPUTATION_SOURCE_WEEKLY_QUEST, Quest::RewardFactionId, Quest::RewardFactionValueId, Quest::RewardFactionValueIdOverride, sFactionStore, and sQuestFactionRewardStore.

◆ RewardReputation() [2/2]

void Player::RewardReputation ( Unit victim)
5983{
5984 if (!victim || victim->IsPlayer())
5985 return;
5986
5987 if (victim->ToCreature()->IsReputationRewardDisabled())
5988 return;
5989
5990 ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry);
5991 if (!Rep)
5992 return;
5993
5994 uint32 ChampioningFaction = 0;
5995
5997 {
5998 // support for: Championing - http://www.wowwiki.com/Championing
5999 Map const* map = GetMap();
6000 if (map->IsNonRaidDungeon())
6001 if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty()))
6002 if (dungeon->TargetLevel == 80)
6003 ChampioningFaction = GetChampioningFaction();
6004 }
6005
6006 TeamId teamId = GetTeamId(true); // Always check player original reputation when rewarding
6007
6008 if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
6009 {
6010 float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
6011
6012 FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
6013 if (factionEntry1)
6014 {
6015 GetReputationMgr().ModifyReputation(factionEntry1, donerep1, false, static_cast<ReputationRank>(Rep->ReputationMaxCap1));
6016 }
6017 }
6018
6019 if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
6020 {
6021 float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
6022
6023 FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
6024 if (factionEntry2)
6025 {
6026 GetReputationMgr().ModifyReputation(factionEntry2, donerep2, false, static_cast<ReputationRank>(Rep->ReputationMaxCap2));
6027 }
6028 }
6029}
LFGDungeonEntry const * GetLFGDungeon(uint32 mapId, Difficulty difficulty)
Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple ...
Definition DBCStores.cpp:852
TeamId
Definition SharedDefines.h:759
bool IsReputationRewardDisabled() const
Definition Creature.h:364
bool IsNonRaidDungeon() const
Definition Map.h:291
uint32 GetChampioningFaction() const
Definition Player.h:2567
uint32 Entry
Definition CreatureData.h:187
Definition DBCStructure.h:1246
Definition ObjectMgr.h:568
uint32 ReputationMaxCap1
Definition ObjectMgr.h:571
float RepValue1
Definition ObjectMgr.h:572
uint32 RepFaction1
Definition ObjectMgr.h:569
uint32 RepFaction2
Definition ObjectMgr.h:570
bool TeamDependent
Definition ObjectMgr.h:577
float RepValue2
Definition ObjectMgr.h:574
uint32 ReputationMaxCap2
Definition ObjectMgr.h:573

References CalculateReputationGain(), CreatureTemplate::Entry, GetChampioningFaction(), Creature::GetCreatureTemplate(), Map::GetDifficulty(), Map::GetId(), Unit::GetLevel(), GetLFGDungeon(), WorldObject::GetMap(), GetReputationMgr(), GetTeamId(), Map::IsNonRaidDungeon(), Object::IsPlayer(), Creature::IsReputationRewardDisabled(), ReputationMgr::ModifyReputation(), ReputationOnKillEntry::RepFaction1, ReputationOnKillEntry::RepFaction2, REPUTATION_SOURCE_KILL, ReputationOnKillEntry::ReputationMaxCap1, ReputationOnKillEntry::ReputationMaxCap2, ReputationOnKillEntry::RepValue1, ReputationOnKillEntry::RepValue2, sFactionStore, sObjectMgr, TEAM_ALLIANCE, TEAM_HORDE, ReputationOnKillEntry::TeamDependent, and Object::ToCreature().

Referenced by KillRewarder::_RewardReputation(), and RewardQuest().

◆ Satisfy()

bool Player::Satisfy ( DungeonProgressionRequirements const *  ar,
uint32  target_map,
bool  report = false 
)
6721{
6722 if (!IsGameMaster() && ar)
6723 {
6724 uint8 LevelMin = 0;
6725 uint8 LevelMax = 0;
6726
6727 MapEntry const* mapEntry = sMapStore.LookupEntry(target_map);
6728 if (!mapEntry)
6729 return false;
6730
6731 if (!sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
6732 {
6733 if (ar->levelMin && GetLevel() < ar->levelMin)
6734 LevelMin = ar->levelMin;
6735 if (ar->levelMax && GetLevel() > ar->levelMax)
6736 LevelMax = ar->levelMax;
6737 }
6738
6739 if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
6740 {
6742 return false;
6743 }
6744
6745 Player* partyLeader = this;
6746 std::string leaderName = m_session->GetAcoreString(LANG_YOU);
6747 {
6748 ObjectGuid leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID();
6749 Player* tempLeader = HashMapHolder<Player>::Find(leaderGuid);
6750 if (leaderGuid != GetGUID())
6751 {
6752 if (tempLeader != nullptr)
6753 {
6754 partyLeader = tempLeader;
6755 }
6756 leaderName = GetGroup()->GetLeaderName();
6757 }
6758 }
6759
6760 //Check all items
6761 std::vector<const ProgressionRequirement*> missingPlayerItems;
6762 std::vector<const ProgressionRequirement*> missingLeaderItems;
6763 for (const ProgressionRequirement* itemRequirement : ar->items)
6764 {
6765 Player* checkPlayer = this;
6766 std::vector<const ProgressionRequirement*>* missingItems = &missingPlayerItems;
6767 if (itemRequirement->checkLeaderOnly)
6768 {
6769 checkPlayer = partyLeader;
6770 missingItems = &missingLeaderItems;
6771 }
6772
6773 if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId(true))
6774 {
6775 if (!checkPlayer->HasItemCount(itemRequirement->id, 1))
6776 {
6777 missingItems->push_back(itemRequirement);
6778 }
6779 }
6780 }
6781
6782 //Check all achievements
6783 std::vector<const ProgressionRequirement*> missingPlayerAchievements;
6784 std::vector<const ProgressionRequirement*> missingLeaderAchievements;
6785 for (const ProgressionRequirement* achievementRequirement : ar->achievements)
6786 {
6787 Player* checkPlayer = this;
6788 std::vector<const ProgressionRequirement*>* missingAchievements = &missingPlayerAchievements;
6789 if (achievementRequirement->checkLeaderOnly)
6790 {
6791 checkPlayer = partyLeader;
6792 missingAchievements = &missingLeaderAchievements;
6793 }
6794
6795 if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId(true))
6796 {
6797 if (!checkPlayer || !checkPlayer->HasAchieved(achievementRequirement->id))
6798 {
6799 missingAchievements->push_back(achievementRequirement);
6800 }
6801 }
6802 }
6803
6804 //Check all quests
6805 std::vector<const ProgressionRequirement*> missingPlayerQuests;
6806 std::vector<const ProgressionRequirement*> missingLeaderQuests;
6807 for (const ProgressionRequirement* questRequirement : ar->quests)
6808 {
6809 Player* checkPlayer = this;
6810 std::vector<const ProgressionRequirement*>* missingQuests = &missingPlayerQuests;
6811 if (questRequirement->checkLeaderOnly)
6812 {
6813 checkPlayer = partyLeader;
6814 missingQuests = &missingLeaderQuests;
6815 }
6816
6817 if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId(true))
6818 {
6819 if (!checkPlayer->GetQuestRewardStatus(questRequirement->id))
6820 {
6821 missingQuests->push_back(questRequirement);
6822 }
6823 }
6824 }
6825
6826 //Check if avg ILVL requirement is allowed
6827 bool ilvlRequirementNotMet = false;
6829 {
6830 const int32 currentIlvl = (int32)GetAverageItemLevelForDF();
6831 if (ar->reqItemLevel > currentIlvl)
6832 {
6833 ilvlRequirementNotMet = true;
6834 }
6835 }
6836
6837 Difficulty target_difficulty = GetDifficulty(mapEntry->IsRaid());
6838 MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(target_map, target_difficulty);
6839 if (LevelMin || LevelMax || ilvlRequirementNotMet
6840 || missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size()
6841 || missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size())
6842 {
6843 if (!sScriptMgr->OnPlayerNotAvoidSatisfy(partyLeader, ar, target_map, report))
6844 return true;
6845
6846 if (report)
6847 {
6848 uint8 requirementPrintMode = sWorld->getIntConfig(CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE);
6849
6850 if (requirementPrintMode == 0)
6851 {
6852 //Just print out the requirements are not met
6854 }
6855 else if (requirementPrintMode == 1)
6856 {
6857 //Blizzlike method of printing out the requirements
6858 if (missingPlayerQuests.size() && !missingPlayerQuests[0]->note.empty())
6859 {
6860 ChatHandler(GetSession()).PSendSysMessage("{}", missingPlayerQuests[0]->note);
6861 }
6862 else if (missingLeaderQuests.size() && !missingLeaderQuests[0]->note.empty())
6863 {
6864 ChatHandler(GetSession()).PSendSysMessage("{}", missingLeaderQuests[0]->note);
6865 }
6866 else if (mapDiff->hasErrorMessage)
6867 {
6868 // if (missingAchievement) covered by this case
6869 SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
6870 }
6871 else if (missingPlayerItems.size())
6872 {
6874 std::string name = sObjectMgr->GetItemTemplate(missingPlayerItems[0]->id)->Name1;
6875 if (ItemLocale const* il = sObjectMgr->GetItemLocale(missingPlayerItems[0]->id))
6876 {
6877 ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
6878 }
6880 }
6881 else if (LevelMin)
6882 {
6884 }
6885 else if (ilvlRequirementNotMet)
6886 {
6888 }
6889 }
6890 else
6891 {
6892 bool errorAlreadyPrinted = false;
6893 //Pretty way of printing out requirements
6894 if (missingPlayerQuests.size())
6895 {
6897 PrettyPrintRequirementsQuestList(missingPlayerQuests);
6898 errorAlreadyPrinted = true;
6899 }
6900 if (missingLeaderQuests.size())
6901 {
6903 PrettyPrintRequirementsQuestList(missingLeaderQuests);
6904 errorAlreadyPrinted = true;
6905 }
6906
6907 if (missingPlayerAchievements.size())
6908 {
6910 PrettyPrintRequirementsAchievementsList(missingPlayerAchievements);
6911 errorAlreadyPrinted = true;
6912 }
6913 if (missingLeaderAchievements.size())
6914 {
6916 PrettyPrintRequirementsAchievementsList(missingLeaderAchievements);
6917 errorAlreadyPrinted = true;
6918 }
6919
6920 if (missingPlayerItems.size())
6921 {
6923 PrettyPrintRequirementsItemsList(missingPlayerItems);
6924 errorAlreadyPrinted = true;
6925 }
6926
6927 if (missingLeaderItems.size())
6928 {
6930 PrettyPrintRequirementsItemsList(missingLeaderItems);
6931 errorAlreadyPrinted = true;
6932 }
6933
6934 if (ilvlRequirementNotMet)
6935 {
6937 }
6938
6939 if (LevelMin)
6940 {
6942 }
6943 else if (LevelMax)
6944 {
6946 }
6947 else if (mapDiff->hasErrorMessage && !errorAlreadyPrinted)
6948 {
6949 SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
6950 }
6951 }
6952
6953 //Print the extra string
6955 if (optionalStringID > 0)
6956 {
6957 ChatHandler(GetSession()).SendSysMessage(optionalStringID);
6958 }
6959 }
6960 return false;
6961 }
6962 }
6963 return true;
6964}
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
Definition DBCStores.cpp:767
@ DISABLE_TYPE_MAP
Definition DisableMgr.h:30
@ LANG_INSTANCE_CLOSED
Definition Language.h:1062
@ LANG_ACCESS_REQUIREMENT_LEADER_OBTAIN_ITEMS
Definition Language.h:857
@ LANG_YOU
Definition Language.h:76
@ LANG_ACCESS_REQUIREMENT_AVERAGE_ILVL_NOT_MET
Definition Language.h:853
@ LANG_ACCESS_REQUIREMENT_OBTAIN_ITEMS
Definition Language.h:850
@ LANG_ACCESS_REQUIREMENT_COMPLETE_QUESTS
Definition Language.h:848
@ LANG_ACCESS_REQUIREMENT_NOT_MET
Definition Language.h:852
@ LANG_LEVEL_MINREQUIRED_AND_ITEM
Definition Language.h:82
@ LANG_ACCESS_REQUIREMENT_MAX_LEVEL
Definition Language.h:854
@ LANG_ACCESS_REQUIREMENT_COMPLETE_ACHIEVEMENTS
Definition Language.h:849
@ LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_QUESTS
Definition Language.h:855
@ LANG_LEVEL_MINREQUIRED
Definition Language.h:81
@ LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_ACHIEVEMENTS
Definition Language.h:856
@ TRANSFER_ABORT_DIFFICULTY
Definition Player.h:797
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_OPTIONAL_STRING_ID
Definition WorldConfig.h:357
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE
Definition WorldConfig.h:356
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PORTAL_CHECK_ILVL
Definition WorldConfig.h:122
@ CONFIG_INSTANCE_IGNORE_LEVEL
Definition WorldConfig.h:43
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:160
const char * GetLeaderName() const
Definition Group.cpp:2310
ObjectGuid GetLeaderGUID() const
Definition Group.cpp:2295
float GetAverageItemLevelForDF()
Definition Player.cpp:15711
void PrettyPrintRequirementsQuestList(const std::vector< const ProgressionRequirement * > &missingQuests) const
Definition PlayerStorage.cpp:6612
void PrettyPrintRequirementsItemsList(const std::vector< const ProgressionRequirement * > &missingItems) const
Definition PlayerStorage.cpp:6682
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0)
Definition Player.cpp:11686
void PrettyPrintRequirementsAchievementsList(const std::vector< const ProgressionRequirement * > &missingAchievements) const
Definition PlayerStorage.cpp:6649
void SendAreaTriggerMessage(std::string_view str)
Definition WorldSession.cpp:231
Definition DBCStructure.h:2223
bool hasErrorMessage
Definition DBCStructure.h:2229

References DungeonProgressionRequirements::achievements, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_OPTIONAL_STRING_ID, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PORTAL_CHECK_ILVL, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE, CONFIG_INSTANCE_IGNORE_LEVEL, DISABLE_TYPE_MAP, HashMapHolder< T >::Find(), WorldSession::GetAcoreString(), GetAverageItemLevelForDF(), GetDifficulty(), GetDownscaledMapDifficultyData(), GetGroup(), Object::GetGUID(), Group::GetLeaderGUID(), Group::GetLeaderName(), Unit::GetLevel(), ObjectMgr::GetLocaleString(), GetQuestRewardStatus(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), GetTeamId(), HasAchieved(), MapDifficulty::hasErrorMessage, HasItemCount(), IsGameMaster(), MapEntry::IsRaid(), DungeonProgressionRequirements::items, LANG_ACCESS_REQUIREMENT_AVERAGE_ILVL_NOT_MET, LANG_ACCESS_REQUIREMENT_COMPLETE_ACHIEVEMENTS, LANG_ACCESS_REQUIREMENT_COMPLETE_QUESTS, LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_ACHIEVEMENTS, LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_QUESTS, LANG_ACCESS_REQUIREMENT_LEADER_OBTAIN_ITEMS, LANG_ACCESS_REQUIREMENT_MAX_LEVEL, LANG_ACCESS_REQUIREMENT_NOT_MET, LANG_ACCESS_REQUIREMENT_OBTAIN_ITEMS, LANG_INSTANCE_CLOSED, LANG_LEVEL_MINREQUIRED, LANG_LEVEL_MINREQUIRED_AND_ITEM, LANG_YOU, DungeonProgressionRequirements::levelMax, DungeonProgressionRequirements::levelMin, m_session, PrettyPrintRequirementsAchievementsList(), PrettyPrintRequirementsItemsList(), PrettyPrintRequirementsQuestList(), ChatHandler::PSendSysMessage(), DungeonProgressionRequirements::quests, DungeonProgressionRequirements::reqItemLevel, sDisableMgr, WorldSession::SendAreaTriggerMessage(), ChatHandler::SendSysMessage(), SendTransferAborted(), sMapStore, sObjectMgr, sScriptMgr, sWorld, TEAM_NEUTRAL, and TRANSFER_ABORT_DIFFICULTY.

Referenced by Spell::CheckCast(), WorldSession::HandleSetRaidDifficultyOpcode(), and MapMgr::PlayerCannotEnter().

◆ SatisfyQuestClass()

bool Player::SatisfyQuestClass ( Quest const *  qInfo,
bool  msg 
) const
1086{
1087 uint32 reqClass = qInfo->GetRequiredClasses();
1088
1089 if (reqClass == 0)
1090 return true;
1091
1092 if ((reqClass & getClassMask()) == 0)
1093 {
1094 if (msg)
1096
1097 return false;
1098 }
1099
1100 return true;
1101}
@ INVALIDREASON_DONT_HAVE_REQ
Definition QuestDef.h:48
void SendCanTakeQuestResponse(uint32 msg) const
Definition PlayerQuest.cpp:2405

References Unit::getClassMask(), Quest::GetRequiredClasses(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestConditions()

bool Player::SatisfyQuestConditions ( Quest const *  qInfo,
bool  msg 
)
1160{
1161 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, qInfo->GetQuestId());
1162 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1163 {
1164 if (msg)
1166 LOG_DEBUG("condition", "Player::SatisfyQuestConditions: conditions not met for quest {}", qInfo->GetQuestId());
1167 return false;
1168 }
1169 return true;
1170}

References CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, Quest::GetQuestId(), INVALIDREASON_DONT_HAVE_REQ, LOG_DEBUG, sConditionMgr, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest().

◆ SatisfyQuestDay()

bool Player::SatisfyQuestDay ( Quest const *  qInfo,
bool  msg 
) const
1269{
1270 if (!qInfo->IsDaily() && !qInfo->IsDFQuest())
1271 return true;
1272
1273 if (qInfo->IsDFQuest())
1274 {
1275 if (m_DFQuests.find(qInfo->GetQuestId()) != m_DFQuests.end())
1276 return false;
1277
1278 return true;
1279 }
1280
1281 bool have_slot = false;
1282 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
1283 {
1284 uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx);
1285 if (qInfo->GetQuestId() == id)
1286 return false;
1287
1288 if (!id)
1289 have_slot = true;
1290 }
1291
1292 if (!have_slot)
1293 {
1294 if (msg)
1296 return false;
1297 }
1298
1299 return true;
1300}
@ INVALIDREASON_DAILY_QUESTS_REMAINING
Definition QuestDef.h:58

References Quest::GetQuestId(), Object::GetUInt32Value(), INVALIDREASON_DAILY_QUESTS_REMAINING, Quest::IsDaily(), Quest::IsDFQuest(), m_DFQuests, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and SendCanTakeQuestResponse().

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), and SatisfyQuestExclusiveGroup().

◆ SatisfyQuestExclusiveGroup()

bool Player::SatisfyQuestExclusiveGroup ( Quest const *  qInfo,
bool  msg 
) const
1184{
1185 // non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed
1186 if (qInfo->GetExclusiveGroup() <= 0)
1187 return true;
1188
1189 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qInfo->GetExclusiveGroup()));
1190
1191 for (; range.first != range.second; ++range.first)
1192 {
1193 uint32 exclude_Id = range.first->second;
1194
1195 // skip checked quest id, only state of other quests in group is interesting
1196 if (exclude_Id == qInfo->GetQuestId())
1197 continue;
1198
1199 // not allow have daily quest if daily quest from exclusive group already recently completed
1200 Quest const* Nquest = sObjectMgr->GetQuestTemplate(exclude_Id);
1201 if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false))
1202 {
1203 if (msg)
1205
1206 return false;
1207 }
1208
1209 // alternative quest already started or completed - but don't check rewarded states if both are repeatable
1210 if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE || (!(qInfo->IsRepeatable() && Nquest->IsRepeatable()) && !Nquest->IsSeasonal() && IsQuestRewarded(exclude_Id))) // pussywizard: added !Nquest->IsSeasonal() because seasonal quests are considered rewarded only if finished this year, this is checked above in SatisfyQuestSeasonal
1211 {
1212 if (msg)
1214 return false;
1215 }
1216 }
1217 return true;
1218}
std::pair< ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator > ExclusiveQuestGroupsBounds
Definition ObjectMgr.h:1144

References Quest::GetExclusiveGroup(), Quest::GetQuestId(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), QUEST_STATUS_NONE, SatisfyQuestDay(), SatisfyQuestSeasonal(), SatisfyQuestWeek(), SendCanTakeQuestResponse(), and sObjectMgr.

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestLevel()

bool Player::SatisfyQuestLevel ( Quest const *  qInfo,
bool  msg 
) const
968{
969 if (GetLevel() < qInfo->GetMinLevel())
970 {
971 if (msg)
973 return false;
974 }
975 else if (qInfo->GetMaxLevel() > 0 && GetLevel() > qInfo->GetMaxLevel())
976 {
977 if (msg)
978 SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
979 return false;
980 }
981 return true;
982}
@ INVALIDREASON_QUEST_FAILED_LOW_LEVEL
Definition QuestDef.h:49

References Unit::GetLevel(), Quest::GetMaxLevel(), Quest::GetMinLevel(), INVALIDREASON_DONT_HAVE_REQ, INVALIDREASON_QUEST_FAILED_LOW_LEVEL, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest(), npc_wg_quest_giver::GetDialogStatus(), and GetQuestDialogStatus().

◆ SatisfyQuestLog()

bool Player::SatisfyQuestLog ( bool  msg)
985{
986 // exist free slot
988 return true;
989
990 if (msg)
991 {
993 GetSession()->SendPacket(&data);
994 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTLOG_FULL");
995 }
996 return false;
997}
@ SMSG_QUESTLOG_FULL
Definition Opcodes.h:435

References FindQuestSlot(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, WorldSession::SendPacket(), and SMSG_QUESTLOG_FULL.

Referenced by CanAddQuest(), and WorldSession::HandlePushQuestToParty().

◆ SatisfyQuestMonth()

bool Player::SatisfyQuestMonth ( Quest const *  qInfo,
bool  msg 
) const
1327{
1328 if (!qInfo->IsMonthly() || m_monthlyquests.empty())
1329 return true;
1330
1331 // if not found in cooldown list
1332 return m_monthlyquests.find(qInfo->GetQuestId()) == m_monthlyquests.end();
1333}

References Quest::GetQuestId(), Quest::IsMonthly(), and m_monthlyquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestNextChain()

bool Player::SatisfyQuestNextChain ( Quest const *  qInfo,
bool  msg 
) const
1221{
1222 uint32 nextQuest = qInfo->GetNextQuestInChain();
1223 if (!nextQuest)
1224 return true;
1225
1226 // next quest in chain already started or completed
1227 if (GetQuestStatus(nextQuest) != QUEST_STATUS_NONE) // GetQuestStatus returns QUEST_STATUS_COMPLETED for rewarded quests
1228 {
1229 if (msg)
1231 return false;
1232 }
1233
1234 // check for all quests further up the chain
1235 // only necessary if there are quest chains with more than one quest that can be skipped
1236 //return SatisfyQuestNextChain(qInfo->GetNextQuestInChain(), msg);
1237 return true;
1238}

References Quest::GetNextQuestInChain(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestPrevChain()

bool Player::SatisfyQuestPrevChain ( Quest const *  qInfo,
bool  msg 
) const
1241{
1242 // No previous quest in chain
1243 if (qInfo->prevChainQuests.empty())
1244 return true;
1245
1246 for (Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter)
1247 {
1248 QuestStatusMap::const_iterator itr = m_QuestStatus.find(*iter);
1249
1250 // If any of the previous quests in chain active, return false
1251 if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE)
1252 {
1253 if (msg)
1255 return false;
1256 }
1257
1258 // check for all quests further down the chain
1259 // only necessary if there are quest chains with more than one quest that can be skipped
1260 //if (!SatisfyQuestPrevChain(prevId, msg))
1261 // return false;
1262 }
1263
1264 // No previous quest in chain active
1265 return true;
1266}

References INVALIDREASON_DONT_HAVE_REQ, m_QuestStatus, Quest::prevChainQuests, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestPreviousQuest()

bool Player::SatisfyQuestPreviousQuest ( Quest const *  qInfo,
bool  msg 
) const
1000{
1001 // No previous quest (might be first quest in a series)
1002 if (qInfo->prevQuests.empty())
1003 return true;
1004
1005 for (Quest::PrevQuests::const_iterator iter = qInfo->prevQuests.begin(); iter != qInfo->prevQuests.end(); ++iter)
1006 {
1007 uint32 prevId = std::abs(*iter);
1008
1009 Quest const* qPrevInfo = sObjectMgr->GetQuestTemplate(prevId);
1010
1011 if (qPrevInfo)
1012 {
1013 // If any of the positive previous quests completed, return true
1014 if (*iter > 0 && IsQuestRewarded(prevId) && (!qPrevInfo->IsSeasonal() || !SatisfyQuestSeasonal(qPrevInfo, false)))
1015 {
1016 // skip one-from-all exclusive group
1017 if (qPrevInfo->GetExclusiveGroup() >= 0)
1018 return true;
1019
1020 // each-from-all exclusive group (< 0)
1021 // can be start if only all quests in prev quest exclusive group completed and rewarded
1022 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
1023
1024 for (; range.first != range.second; ++range.first)
1025 {
1026 uint32 exclude_Id = range.first->second;
1027
1028 // skip checked quest id, only state of other quests in group is interesting
1029 if (exclude_Id == prevId)
1030 continue;
1031
1032 // alternative quest from group also must be completed and rewarded(reported)
1033
1034 Quest const* qExcludeInfo = sObjectMgr->GetQuestTemplate(exclude_Id);
1035 if (!IsQuestRewarded(exclude_Id) || (qExcludeInfo->IsSeasonal() && SatisfyQuestSeasonal(qExcludeInfo, false)))
1036 {
1037 if (msg)
1039 return false;
1040 }
1041 }
1042 return true;
1043 }
1044
1045 // If any of the negative previous quests active, return true
1046 if (*iter < 0 && GetQuestStatus(prevId) != QUEST_STATUS_NONE)
1047 {
1048 // skip one-from-all exclusive group
1049 if (qPrevInfo->GetExclusiveGroup() >= 0)
1050 return true;
1051
1052 // each-from-all exclusive group (< 0)
1053 // can be start if only all quests in prev quest exclusive group active
1054 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
1055
1056 for (; range.first != range.second; ++range.first)
1057 {
1058 uint32 exclude_Id = range.first->second;
1059
1060 // skip checked quest id, only state of other quests in group is interesting
1061 if (exclude_Id == prevId)
1062 continue;
1063
1064 // alternative quest from group also must be active
1065 if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE)
1066 {
1067 if (msg)
1069 return false;
1070 }
1071 }
1072 return true;
1073 }
1074 }
1075 }
1076
1077 // Has only positive prev. quests in non-rewarded state
1078 // and negative prev. quests in non-active state
1079 if (msg)
1081
1082 return false;
1083}
int32 GetExclusiveGroup() const
Definition QuestDef.h:251

References Quest::GetExclusiveGroup(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, IsQuestRewarded(), Quest::IsSeasonal(), Quest::prevQuests, QUEST_STATUS_NONE, SatisfyQuestSeasonal(), SendCanTakeQuestResponse(), and sObjectMgr.

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestRace()

bool Player::SatisfyQuestRace ( Quest const *  qInfo,
bool  msg 
) const
1104{
1105 uint32 reqraces = qInfo->GetAllowableRaces();
1106 if (reqraces == 0)
1107 return true;
1108 if ((reqraces & getRaceMask()) == 0)
1109 {
1110 if (msg)
1112 return false;
1113 }
1114 return true;
1115}
@ INVALIDREASON_QUEST_FAILED_WRONG_RACE
Definition QuestDef.h:50

References Quest::GetAllowableRaces(), Unit::getRaceMask(), INVALIDREASON_QUEST_FAILED_WRONG_RACE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestReputation()

bool Player::SatisfyQuestReputation ( Quest const *  qInfo,
bool  msg 
) const
1118{
1119 uint32 fIdMin = qInfo->GetRequiredMinRepFaction(); //Min required rep
1120 if (fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue())
1121 {
1122 if (msg)
1124 return false;
1125 }
1126
1127 uint32 fIdMax = qInfo->GetRequiredMaxRepFaction(); //Max required rep
1128 if (fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue())
1129 {
1130 if (msg)
1132 return false;
1133 }
1134
1135 // ReputationObjective2 does not seem to be an objective requirement but a requirement
1136 // to be able to accept the quest
1137 uint32 fIdObj = qInfo->GetRepObjectiveFaction2();
1138 if (fIdObj && GetReputationMgr().GetReputation(fIdObj) >= qInfo->GetRepObjectiveValue2())
1139 {
1140 if (msg)
1142 return false;
1143 }
1144
1145 return true;
1146}

References Quest::GetRepObjectiveFaction2(), Quest::GetRepObjectiveValue2(), GetReputation(), GetReputationMgr(), Quest::GetRequiredMaxRepFaction(), Quest::GetRequiredMaxRepValue(), Quest::GetRequiredMinRepFaction(), Quest::GetRequiredMinRepValue(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestSeasonal()

bool Player::SatisfyQuestSeasonal ( Quest const *  qInfo,
bool  msg 
) const
1312{
1313 if (!qInfo->IsSeasonal() || m_seasonalquests.empty())
1314 return true;
1315
1316 // cppcheck-suppress mismatchingContainers
1317 Player::SeasonalEventQuestMap::iterator itr = ((Player*)this)->m_seasonalquests.find(qInfo->GetEventIdForQuest());
1318
1319 if (itr == m_seasonalquests.end() || itr->second.empty())
1320 return true;
1321
1322 // if not found in cooldown list
1323 return itr->second.find(qInfo->GetQuestId()) == itr->second.end();
1324}

References Quest::GetEventIdForQuest(), Quest::GetQuestId(), Quest::IsSeasonal(), and m_seasonalquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), GetQuestRewardStatus(), GetQuestStatus(), SatisfyQuestExclusiveGroup(), and SatisfyQuestPreviousQuest().

◆ SatisfyQuestSkill()

bool Player::SatisfyQuestSkill ( Quest const *  qInfo,
bool  msg 
) const
948{
949 uint32 skill = qInfo->GetRequiredSkill();
950
951 // skip 0 case RequiredSkill
952 if (skill == 0)
953 return true;
954
955 // check skill value
956 if (GetBaseSkillValue(skill) < qInfo->GetRequiredSkillValue())
957 {
958 if (msg)
960
961 return false;
962 }
963
964 return true;
965}

References GetBaseSkillValue(), Quest::GetRequiredSkill(), Quest::GetRequiredSkillValue(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestStatus()

bool Player::SatisfyQuestStatus ( Quest const *  qInfo,
bool  msg 
) const
1149{
1150 if (GetQuestStatus(qInfo->GetQuestId()) != QUEST_STATUS_NONE)
1151 {
1152 if (msg)
1154 return false;
1155 }
1156 return true;
1157}
@ INVALIDREASON_QUEST_ALREADY_ON
Definition QuestDef.h:53

References Quest::GetQuestId(), GetQuestStatus(), INVALIDREASON_QUEST_ALREADY_ON, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest(), and WorldSession::HandlePushQuestToParty().

◆ SatisfyQuestTimed()

bool Player::SatisfyQuestTimed ( Quest const *  qInfo,
bool  msg 
) const
1173{
1174 if (!m_timedquests.empty() && qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
1175 {
1176 if (msg)
1178 return false;
1179 }
1180 return true;
1181}
@ INVALIDREASON_QUEST_ONLY_ONE_TIMED
Definition QuestDef.h:52

References Quest::HasSpecialFlag(), INVALIDREASON_QUEST_ONLY_ONE_TIMED, m_timedquests, QUEST_SPECIAL_FLAGS_TIMED, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest().

◆ SatisfyQuestWeek()

bool Player::SatisfyQuestWeek ( Quest const *  qInfo,
bool  msg 
) const
1303{
1304 if (!qInfo->IsWeekly() || m_weeklyquests.empty())
1305 return true;
1306
1307 // if not found in cooldown list
1308 return m_weeklyquests.find(qInfo->GetQuestId()) == m_weeklyquests.end();
1309}

References Quest::GetQuestId(), Quest::IsWeekly(), and m_weeklyquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), and SatisfyQuestExclusiveGroup().

◆ SaveGoldToDB()

void Player::SaveGoldToDB ( CharacterDatabaseTransaction  trans)
7142{
7144 stmt->SetData(0, GetMoney());
7145 stmt->SetData(1, GetGUID().GetCounter());
7146 trans->Append(stmt);
7147}
@ CHAR_UDP_CHAR_MONEY
Definition CharacterDatabase.h:429

References CHAR_UDP_CHAR_MONEY, CharacterDatabase, Object::GetGUID(), GetMoney(), and PreparedStatementBase::SetData().

Referenced by WorldSession::HandleMailTakeMoney(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), and SaveInventoryAndGoldToDB().

◆ SaveHealthBeforeDuel()

void Player::SaveHealthBeforeDuel ( )
inline

◆ SaveInventoryAndGoldToDB()

void Player::SaveInventoryAndGoldToDB ( CharacterDatabaseTransaction  trans)
7136{
7137 _SaveInventory(trans);
7138 SaveGoldToDB(trans);
7139}
void SaveGoldToDB(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7141
void _SaveInventory(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7255

References _SaveInventory(), and SaveGoldToDB().

Referenced by WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleMailTakeItem(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleSendMail(), WorldSession::HandleWrapItemOpcode(), and RefundItem().

◆ SaveManaBeforeDuel()

void Player::SaveManaBeforeDuel ( )
inline

◆ SavePositionInDB() [1/2]

void Player::SavePositionInDB ( uint32  mapid,
float  x,
float  y,
float  z,
float  o,
uint32  zone,
ObjectGuid  guid 
)
static

◆ SavePositionInDB() [2/2]

void Player::SavePositionInDB ( WorldLocation const &  loc,
uint16  zoneId,
ObjectGuid  guid,
CharacterDatabaseTransaction  trans 
)
static
100{
102
103 stmt->SetData(0, loc.GetPositionX());
104 stmt->SetData(1, loc.GetPositionY());
105 stmt->SetData(2, loc.GetPositionZ());
106 stmt->SetData(3, loc.GetOrientation());
107 stmt->SetData(4, uint16(loc.GetMapId()));
108 stmt->SetData(5, zoneId);
109 stmt->SetData(6, guid.GetCounter());
110
111 CharacterDatabase.ExecuteOrAppend(trans, stmt);
112}

References CHAR_UPD_CHARACTER_POSITION, CharacterDatabase, ObjectGuid::GetCounter(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and PreparedStatementBase::SetData().

◆ SaveRecallPosition()

◆ SaveToDB() [1/2]

◆ SaveToDB() [2/2]

void Player::SaveToDB ( CharacterDatabaseTransaction  trans,
bool  create,
bool  logout 
)
7074{
7075 // delay auto save at any saves (manual, in code, or autosave)
7076 m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
7077
7078 //lets allow only players in world to be saved
7080 {
7082 return;
7083 }
7084
7085 // pussywizard: full save now, so clear partial additional saves
7088
7089 // first save/honor gain after midnight will also update the player's honor fields
7091
7092 LOG_DEBUG("entities.unit", "The value of player {} at save: ", m_name);
7094
7095 if (!create)
7096 sScriptMgr->OnPlayerSave(this);
7097
7098 _SaveCharacter(create, trans);
7099
7100 if (m_mailsUpdated) //save mails only when needed
7101 _SaveMail(trans);
7102
7103 _SaveEntryPoint(trans);
7104 _SaveInventory(trans);
7105 _SaveQuestStatus(trans);
7106 _SaveDailyQuestStatus(trans);
7110 _SaveTalents(trans);
7111 _SaveSpells(trans);
7112 _SaveSpellCooldowns(trans, logout);
7113 _SaveActions(trans);
7114 _SaveAuras(trans, logout);
7115 _SaveSkills(trans);
7116 m_achievementMgr->SaveToDB(trans);
7117 m_reputationMgr->SaveToDB(trans);
7118 _SaveEquipmentSets(trans);
7119 GetSession()->SaveTutorialsData(trans); // changed only while character in game
7120 _SaveGlyphs(trans);
7122 _SavePlayerSettings(trans);
7123
7124 // check if stats should only be saved on logout
7125 // save stats can be out of transaction
7127 _SaveStats(trans);
7128
7129 // save pet (hunter pet level and experience and all type pets health/mana).
7130 if (Pet* pet = GetPet())
7131 pet->SavePetToDB(PET_SAVE_AS_CURRENT);
7132}
@ CONFIG_STATS_SAVE_ONLY_ON_LOGOUT
Definition WorldConfig.h:29
void SaveToDB(CharacterDatabaseTransaction trans)
Definition AchievementMgr.cpp:562
bool IsBeingTeleportedFar() const
Definition Player.h:2110
void _SaveMonthlyQuestStatus(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7630
void _SaveTalents(CharacterDatabaseTransaction trans)
Definition Player.cpp:14992
void _SaveDailyQuestStatus(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7535
void _SaveSpells(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7708
void _SaveCharacter(bool create, CharacterDatabaseTransaction trans)
Definition Player.cpp:14649
void _SaveSkills(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7652
void _SaveEquipmentSets(CharacterDatabaseTransaction trans)
Definition Player.cpp:14515
void _SaveGlyphs(CharacterDatabaseTransaction trans)
Definition Player.cpp:14948
void _SaveMail(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7393
void _SaveQuestStatus(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7468
void _SaveAuras(CharacterDatabaseTransaction trans, bool logout)
Definition PlayerStorage.cpp:7197
void _SaveSeasonalQuestStatus(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7596
void _SaveInstanceTimeRestrictions(CharacterDatabaseTransaction trans)
Definition Player.cpp:15838
void _SavePlayerSettings(CharacterDatabaseTransaction trans)
Definition PlayerSettings.cpp:74
void _SaveWeeklyQuestStatus(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7573
void _SaveSpellCooldowns(CharacterDatabaseTransaction trans, bool logout)
Definition Player.cpp:3648
void _SaveEntryPoint(CharacterDatabaseTransaction trans)
Definition Player.cpp:14566
void _SaveStats(CharacterDatabaseTransaction trans)
Definition PlayerStorage.cpp:7755
void SaveToDB(CharacterDatabaseTransaction trans)
Definition ReputationMgr.cpp:628
bool isLogingOut() const
Is the user engaged in a log out process?
Definition WorldSession.h:404
void SaveTutorialsData(CharacterDatabaseTransaction trans)
Definition WorldSession.cpp:979

References _SaveActions(), _SaveAuras(), _SaveCharacter(), _SaveDailyQuestStatus(), _SaveEntryPoint(), _SaveEquipmentSets(), _SaveGlyphs(), _SaveInstanceTimeRestrictions(), _SaveInventory(), _SaveMail(), _SaveMonthlyQuestStatus(), _SavePlayerSettings(), _SaveQuestStatus(), _SaveSeasonalQuestStatus(), _SaveSkills(), _SaveSpellCooldowns(), _SaveSpells(), _SaveStats(), _SaveTalents(), _SaveWeeklyQuestStatus(), CONFIG_INTERVAL_SAVE, CONFIG_STATS_SAVE_ONLY_ON_LOGOUT, DELAYED_SAVE_PLAYER, GetPet(), GetSession(), IsBeingTeleportedFar(), WorldSession::isLogingOut(), LOG_DEBUG, m_achievementMgr, m_additionalSaveMask, m_additionalSaveTimer, m_mailsUpdated, WorldObject::m_name, m_nextSave, m_reputationMgr, m_session, outDebugValues(), PET_SAVE_AS_CURRENT, AchievementMgr::SaveToDB(), ReputationMgr::SaveToDB(), WorldSession::SaveTutorialsData(), ScheduleDelayedOperation(), sScriptMgr, sWorld, and UpdateHonorFields().

◆ Say() [1/2]

void Player::Say ( std::string_view  text,
Language  language,
WorldObject const *  = nullptr 
)
overridevirtual

Handles said message in regular chat based on declared language and in config pre-defined Range.

Reimplemented from Unit.

9368{
9369 std::string _text(text);
9370 if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_SAY, language, _text))
9371 {
9372 return;
9373 }
9374
9375 sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
9376
9377 WorldPacket data;
9378 ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
9379
9380 SendDirectMessage(&data);
9381
9382 // Special handling for messages, do not use visibility map for stealthed units
9383 Acore::MessageDistDeliverer notifier(this, &data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), false, nullptr, true);
9384 Cell::VisitObjects(this, notifier, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
9385}
@ CHAT_MSG_SAY
Definition SharedDefines.h:3392
@ CONFIG_LISTEN_RANGE_SAY
Definition WorldConfig.h:147
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:265
Definition GridNotifiers.h:99
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References ChatHandler::BuildChatPacket(), CHAT_MSG_SAY, CONFIG_LISTEN_RANGE_SAY, SendDirectMessage(), sScriptMgr, sWorld, and Cell::VisitObjects().

Referenced by Unit::HandleDummyAuraProc(), WorldSession::HandleMessagechatOpcode(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_jungle_punch_target::npc_jungle_punch_targetAI::SpellHit(), and boss_headless_horseman::UpdateAI().

◆ Say() [2/2]

void Player::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
overridevirtual

Reimplemented from Unit.

9388{
9389 Talk(textId, CHAT_MSG_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
9390}
Talk
Definition hyjal.cpp:82

References CHAT_MSG_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ ScheduleDelayedOperation()

void Player::ScheduleDelayedOperation ( uint32  operation)
inline
2118 {
2119 if (operation < DELAYED_END)
2120 m_DelayedOperations |= operation;
2121 }
@ DELAYED_END
Definition Player.h:917

References DELAYED_END, and m_DelayedOperations.

Referenced by Battleground::RemovePlayerAtLeave(), ResurectUsingRequestData(), SaveToDB(), and TeleportToEntryPoint().

◆ SendActionButtons()

void Player::SendActionButtons ( uint32  state) const
5585{
5586 LOG_DEBUG("entities.player", "Sending Action Buttons for {} spec {}", GetGUID().ToString(), m_activeSpec);
5587
5589 data << uint8(state);
5590 /*
5591 state can be 0, 1, 2
5592 0 - Looks to be sent when initial action buttons get sent, however on Trinity we use 1 since 0 had some difficulties
5593 1 - Used in any SMSG_ACTION_BUTTONS packet with button data on Trinity. Only used after spec swaps on retail.
5594 2 - Clears the action bars client sided. This is sent during spec swap before unlearning and before sending the new buttons
5595 */
5596 if (state != 2)
5597 {
5598 for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
5599 {
5600 ActionButtonList::const_iterator itr = m_actionButtons.find(button);
5601 if (itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED)
5602 data << uint32(itr->second.packedData);
5603 else
5604 data << uint32(0);
5605 }
5606 }
5607
5608 GetSession()->SendPacket(&data);
5609 LOG_DEBUG("entities.player", "Action Buttons for {} spec {} Sent", GetGUID().ToString(), m_activeSpec);
5610}
@ SMSG_ACTION_BUTTONS
Definition Opcodes.h:327

References ACTIONBUTTON_DELETED, Object::GetGUID(), GetSession(), LOG_DEBUG, m_actionButtons, m_activeSpec, MAX_ACTION_BUTTONS, WorldSession::SendPacket(), SMSG_ACTION_BUTTONS, and Position::ToString().

Referenced by ActivateSpec(), WorldSession::HandleLoadActionsSwitchSpec(), LoadActions(), and SendInitialActionButtons().

◆ SendAttackSwingBadFacingAttack()

void Player::SendAttackSwingBadFacingAttack ( )
147{
149 GetSession()->SendPacket(&data);
150}
@ SMSG_ATTACKSWING_BADFACING
Definition Opcodes.h:356

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_BADFACING.

Referenced by Update().

◆ SendAttackSwingCancelAttack()

◆ SendAttackSwingCantAttack()

void Player::SendAttackSwingCantAttack ( )
135{
137 GetSession()->SendPacket(&data);
138}
@ SMSG_ATTACKSWING_CANT_ATTACK
Definition Opcodes.h:359

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_CANT_ATTACK.

◆ SendAttackSwingDeadTarget()

void Player::SendAttackSwingDeadTarget ( )
129{
131 GetSession()->SendPacket(&data);
132}
@ SMSG_ATTACKSWING_DEADTARGET
Definition Opcodes.h:358

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_DEADTARGET.

◆ SendAttackSwingNotInRange()

void Player::SendAttackSwingNotInRange ( )
79{
81 GetSession()->SendPacket(&data);
82}
@ SMSG_ATTACKSWING_NOTINRANGE
Definition Opcodes.h:355

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_NOTINRANGE.

Referenced by Update().

◆ SendAutoRepeatCancel()

void Player::SendAutoRepeatCancel ( Unit target)
153{
155 data << target->GetPackGUID(); // may be it's target guid
156 SendMessageToSet(&data, true);
157}
std::size_t size() const
Definition ObjectGuid.h:274
@ SMSG_CANCEL_AUTO_REPEAT
Definition Opcodes.h:698

References Object::GetPackGUID(), SendMessageToSet(), PackedGuid::size(), and SMSG_CANCEL_AUTO_REPEAT.

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), and Unit::InterruptSpell().

◆ SendBattlefieldWorldStates()

void Player::SendBattlefieldWorldStates ( )

Send misc stuff that needs to be sent on every login, like the battle timers.

8877{
8879 if (sWorld->getIntConfig(CONFIG_WINTERGRASP_ENABLE) == 1)
8880 {
8881 if (BattlefieldWG* wg = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
8882 {
8883 wg->SendUpdateWorldStates(this);
8884 }
8885 }
8886}
@ CONFIG_WINTERGRASP_ENABLE
Definition WorldConfig.h:277
Definition BattlefieldWG.h:253

References BATTLEFIELD_BATTLEID_WG, CONFIG_WINTERGRASP_ENABLE, sBattlefieldMgr, and sWorld.

Referenced by SendInitWorldStates().

◆ SendBGWeekendWorldStates()

void Player::SendBGWeekendWorldStates ( )
8862{
8863 for (uint32 i = 1; i < sBattlemasterListStore.GetNumRows(); ++i)
8864 {
8865 BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(i);
8866 if (bl && bl->HolidayWorldStateId)
8867 {
8870 else
8872 }
8873 }
8874}
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
static bool IsBGWeekend(BattlegroundTypeId bgTypeId)
Definition BattlegroundMgr.cpp:910
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition PlayerUpdates.cpp:2245
Definition DBCStructure.h:604
uint32 HolidayWorldStateId
Definition DBCStructure.h:612
uint32 id
Definition DBCStructure.h:605

References BattlemasterListEntry::HolidayWorldStateId, BattlemasterListEntry::id, BattlegroundMgr::IsBGWeekend(), sBattlemasterListStore, and SendUpdateWorldState().

Referenced by SendInitWorldStates().

◆ SendBuyError()

void Player::SendBuyError ( BuyResult  msg,
Creature creature,
uint32  item,
uint32  param 
)
4065{
4066 LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED");
4067 WorldPacket data(SMSG_BUY_FAILED, (8 + 4 + 4 + 1));
4068 data << (creature ? creature->GetGUID() : ObjectGuid::Empty);
4069 data << uint32(item);
4070 if (param > 0)
4071 data << uint32(param);
4072 data << uint8(msg);
4073 GetSession()->SendPacket(&data);
4074}
@ SMSG_BUY_FAILED
Definition Opcodes.h:451

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_BUY_FAILED.

Referenced by BuyItemFromVendorSlot(), WorldSession::HandleBuybackItem(), debug_commandscript::HandleDebugSendBuyErrorCommand(), WorldSession::HandlePetitionBuyOpcode(), npc_experience::OnGossipSelect(), OnGossipSelect(), ProcessCastaction(), ProcessUnlearnAction(), and resetTalents().

◆ SendCanTakeQuestResponse()

◆ SendCinematicStart()

void Player::SendCinematicStart ( uint32  CinematicSequenceId) const
5731{
5733 data << uint32(CinematicSequenceId);
5734 SendDirectMessage(&data);
5735 if (CinematicSequencesEntry const* sequence = sCinematicSequencesStore.LookupEntry(CinematicSequenceId))
5736 {
5737 _cinematicMgr->SetActiveCinematicCamera(sequence->cinematicCamera);
5738 }
5739}
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
void SetActiveCinematicCamera(uint32 cinematicCameraId=0)
Definition CinematicMgr.h:41
@ SMSG_TRIGGER_CINEMATIC
Definition Opcodes.h:280
Definition DBCStructure.h:713

References _cinematicMgr, sCinematicSequencesStore, SendDirectMessage(), CinematicMgr::SetActiveCinematicCamera(), and SMSG_TRIGGER_CINEMATIC.

Referenced by debug_commandscript::HandleDebugPlayCinematicCommand(), WorldSession::HandlePlayerLoginFromDB(), and GameObject::Use().

◆ SendClearCooldown()

void Player::SendClearCooldown ( uint32  spell_id,
Unit target 
)

◆ SendCooldownEvent()

void Player::SendCooldownEvent ( SpellInfo const *  spellInfo,
uint32  itemId = 0,
Spell spell = nullptr,
bool  setCooldown = true 
)
11087{
11088 // start cooldowns at server side, if any
11089 if (setCooldown)
11090 AddSpellAndCategoryCooldowns(spellInfo, itemId, spell);
11091
11092 // Send activate cooldown timer (possible 0) at client side
11093 WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
11094 data << uint32(spellInfo->Id);
11095 data << GetGUID();
11096 SendDirectMessage(&data);
11097}
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:10888
@ SMSG_COOLDOWN_EVENT
Definition Opcodes.h:339

References AddSpellAndCategoryCooldowns(), Object::GetGUID(), SpellInfo::Id, SendDirectMessage(), and SMSG_COOLDOWN_EVENT.

Referenced by Spell::_handle_finish_phase(), Aura::_UnapplyForTarget(), Spell::finish(), Unit::RemoveGameObject(), Unit::SetMinion(), and UpdatePotionCooldown().

◆ SendCorpseReclaimDelay()

void Player::SendCorpseReclaimDelay ( uint32  delay)
12944{
12946 data << uint32(delay);
12947 GetSession()->SendPacket(&data);
12948}
@ SMSG_CORPSE_RECLAIM_DELAY
Definition Opcodes.h:647

References GetSession(), WorldSession::SendPacket(), and SMSG_CORPSE_RECLAIM_DELAY.

Referenced by BuildPlayerRepop(), and KillPlayer().

◆ SendDirectMessage()

void Player::SendDirectMessage ( WorldPacket const *  data) const
5726{
5727 m_session->SendPacket(data);
5728}

References m_session, and WorldSession::SendPacket().

Referenced by Guild::_SendBankList(), Group::AddMember(), AddSpellAndCategoryCooldowns(), Creature::AddSpellCooldown(), AddSpellMod(), DoRandomRoll(), DuelComplete(), Spell::EffectBind(), Spell::EffectPlayMusic(), BGQueueRemoveEvent::Execute(), GiveLevel(), Aura::HandleAuraSpecificMods(), debug_commandscript::HandleDebugCooldownCommand(), Guild::HandleInviteMember(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), Unit::Kill(), Pet::learnSpell(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), Acore::LocalizedPacketDo< Builder >::operator()(), Acore::LocalizedPacketListDo< Builder >::operator()(), CreatureTextLocalizer< Builder >::operator()(), WorldObject::PlayDirectMusic(), WorldObject::PlayDirectSound(), WorldObject::PlayDistanceSound(), AchievementMgr::RemoveCriteriaProgress(), AchievementMgr::Reset(), Say(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), SendCinematicStart(), SendClearCooldown(), Unit::SendComboPoints(), SendCooldownEvent(), AchievementMgr::SendCriteriaUpdate(), SendDurabilityLoss(), WeatherMgr::SendFineWeatherUpdateToPlayer(), ReputationMgr::SendForceReactions(), ReputationMgr::SendInitialReputations(), Map::SendInitSelf(), SendInitWorldStates(), BattlefieldWG::SendInitWorldStatesTo(), SendLoot(), SendLootError(), SendLootRelease(), Unit::SendMeleeAttackStart(), SendMessageToSet(), SendMessageToSetInRange(), SendMirrorTimer(), Unit::SendMovementFeatherFall(), Unit::SendMovementHover(), Unit::SendMovementWaterWalking(), SendMovieStart(), WorldSessionMgr::SendServerMessage(), Unit::SendSpellNonMeleeReflectLog(), ReputationMgr::SendState(), Unit::SendTameFailure(), SendTaxiNodeStatusMultiple(), SendUpdateWorldState(), BattlefieldWG::SendUpdateWorldStateMessage(), ReputationMgr::SendVisible(), Weather::SendWeatherUpdateToPlayer(), ChatHandler::SendWorldTextOptional(), Map::SendZoneDynamicInfo(), SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), SetDisableGravity(), SetFeatherFall(), Creature::SetFeatherFall(), SetHover(), Unit::SetOwnerGUID(), Unit::SetRooted(), SetWaterWalking(), Creature::SetWaterWalking(), StopMirrorTimer(), TextEmote(), Pet::unlearnSpell(), Acore::MessageDistDeliverer::Visit(), Unit::Whisper(), Unit::Whisper(), Whisper(), and Yell().

◆ SendDuelCountdown()

void Player::SendDuelCountdown ( uint32  counter)
15317{
15319 data << uint32(counter); // seconds
15320 GetSession()->SendPacket(&data);
15321}
@ SMSG_DUEL_COUNTDOWN
Definition Opcodes.h:725

References GetSession(), WorldSession::SendPacket(), and SMSG_DUEL_COUNTDOWN.

Referenced by WorldSession::HandleDuelAcceptedOpcode().

◆ SendDungeonDifficulty()

void Player::SendDungeonDifficulty ( bool  IsInGroup)

◆ SendDurabilityLoss()

void Player::SendDurabilityLoss ( )

◆ SendEnchantmentDurations()

void Player::SendEnchantmentDurations ( )
4734{
4735 for (EnchantDurationList::const_iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4736 {
4737 GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(), itr->slot, uint32(itr->leftduration) / 1000);
4738 }
4739}

References Object::GetGUID(), GetSession(), m_enchantDuration, and WorldSession::SendItemEnchantTimeUpdate().

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendEquipError()

void Player::SendEquipError ( InventoryResult  msg,
Item pItem,
Item pItem2 = nullptr,
uint32  itemid = 0 
)
4022{
4023 LOG_DEBUG("network", "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE ({})", msg);
4025 data << uint8(msg);
4026
4027 if (msg != EQUIP_ERR_OK)
4028 {
4029 data << (pItem ? pItem->GetGUID() : ObjectGuid::Empty);
4030 data << (pItem2 ? pItem2->GetGUID() : ObjectGuid::Empty);
4031 data << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
4032
4033 switch (msg)
4034 {
4037 {
4038 ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
4039 data << uint32(proto ? proto->RequiredLevel : 0);
4040 break;
4041 }
4042 case EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM: // no idea about this one...
4043 {
4044 data << ObjectGuid::Empty; // item guid
4045 data << uint32(0); // slot
4046 data << ObjectGuid::Empty; // container
4047 break;
4048 }
4052 {
4053 ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
4054 data << uint32(proto ? proto->ItemLimitCategory : 0);
4055 break;
4056 }
4057 default:
4058 break;
4059 }
4060 }
4061 GetSession()->SendPacket(&data);
4062}
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED
Definition Item.h:131
@ EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM
Definition Item.h:127
@ EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW
Definition Item.h:133
@ SMSG_INVENTORY_CHANGE_FAILURE
Definition Opcodes.h:304
uint32 RequiredLevel
Definition ItemTemplate.h:636

References ObjectGuid::Empty, EQUIP_ERR_CANT_EQUIP_LEVEL_I, EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED, EQUIP_ERR_OK, EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW, Object::GetGUID(), GetSession(), Item::GetTemplate(), ItemTemplate::ItemLimitCategory, LOG_DEBUG, ItemTemplate::RequiredLevel, WorldSession::SendPacket(), SMSG_INVENTORY_CHANGE_FAILURE, and sObjectMgr.

Referenced by _StoreOrEquipNewItem(), AutoStoreLoot(), BuyItemFromVendorSlot(), CanAddQuest(), CanRewardQuest(), CanRewardQuest(), CastItemUseSpell(), Spell::CheckItems(), Group::CountTheRoll(), Spell::DoCreateItem(), Spell::EffectRechargeManaGem(), GiveQuestSourceItem(), WorldSession::HandleAcceptTradeOpcode(), misc_commandscript::HandleAddItemSetCommand(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), AuraEffect::HandleChannelDeathItem(), debug_commandscript::HandleDebugSendEquipErrorCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleGuildBankSwapItems(), WorldSession::HandleOpenItemOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleReadItem(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSocketOpcode(), WorldSession::HandleSplitItemOpcode(), WorldSession::HandleSwapInvItemOpcode(), WorldSession::HandleSwapItem(), WorldSession::HandleUseItemOpcode(), WorldSession::HandleWrapItemOpcode(), ModifyMoney(), item_petrov_cluster_bombs::OnUse(), item_only_for_flight::OnUse(), item_incendiary_explosives::OnUse(), item_captured_frog::OnUse(), ProcessUnlearnAction(), SetAmmo(), SplitItem(), StoreLootItem(), SwapItem(), and TakeQuestSourceItem().

◆ SendEquipmentSetList()

void Player::SendEquipmentSetList ( )
14445{
14446 uint32 count = 0;
14448 std::size_t count_pos = data.wpos();
14449 data << uint32(count); // count placeholder
14450 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14451 {
14452 if (itr->second.state == EQUIPMENT_SET_DELETED)
14453 continue;
14454
14455 data.appendPackGUID(itr->second.Guid);
14456 data << uint32(itr->first);
14457 data << itr->second.Name;
14458 data << itr->second.IconName;
14459 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14460 {
14461 // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HighGuid::Item
14462 if (itr->second.IgnoreMask & (1 << i))
14463 data.appendPackGUID(uint64(1));
14464 else // xinef: send proper data (do not append 0 with high guid)
14465 data.appendPackGUID(itr->second.Items[i] ? itr->second.Items[i].GetRawValue() : uint64(0));
14466 }
14467
14468 ++count; // client have limit but it checked at loading and set
14469 }
14470 data.put<uint32>(count_pos, count);
14471 GetSession()->SendPacket(&data);
14472}
@ SMSG_EQUIPMENT_SET_LIST
Definition Opcodes.h:1242

References ByteBuffer::appendPackGUID(), EQUIPMENT_SET_DELETED, EQUIPMENT_SLOT_END, GetSession(), m_EquipmentSets, ByteBuffer::put(), WorldSession::SendPacket(), SMSG_EQUIPMENT_SET_LIST, and ByteBuffer::wpos().

Referenced by SendInitialPacketsBeforeAddToMap().

◆ SendExplorationExperience()

void Player::SendExplorationExperience ( uint32  Area,
uint32  Experience 
)
160{
162 data << uint32(Area);
163 data << uint32(Experience);
164 GetSession()->SendPacket(&data);
165}
@ SMSG_EXPLORATION_EXPERIENCE
Definition Opcodes.h:534

References GetSession(), WorldSession::SendPacket(), and SMSG_EXPLORATION_EXPERIENCE.

Referenced by CheckAreaExploreAndOutdoor().

◆ SendInitialActionButtons()

void Player::SendInitialActionButtons ( ) const
inline

◆ SendInitialPacketsAfterAddToMap()

void Player::SendInitialPacketsAfterAddToMap ( )
11605{
11607
11610
11611 CastSpell(this, 836, true); // LOGINEFFECT
11612
11613 // set some aura effects that send packet to player client after add player to map
11614 // SendMessageToSet not send it to player not it map, only for aura that not changed anything at re-apply
11615 // same auras state lost at far teleport, send it one more time in this case also
11616 static const AuraType auratypes[] =
11617 {
11621 };
11622 for (AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
11623 {
11624 Unit::AuraEffectList const& auraList = GetAuraEffectsByType(*itr);
11625 if (!auraList.empty())
11626 auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
11627 }
11628
11629 // Fix mount, update block gets messed somewhere
11630 {
11632 {
11633 AddAura(GetMountBlockId(), this);
11634 SetMountBlockId(0);
11635 }
11636 }
11637
11638 // update zone
11639 uint32 newzone, newarea;
11640 GetZoneAndAreaId(newzone, newarea);
11641 UpdateZone(newzone, newarea); // also call SendInitWorldStates();
11642
11643 if (HasStunAura())
11645
11646 // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied.
11647 if (HasRootAura())
11648 {
11650 data2 << GetPackGUID();
11651 data2 << (uint32)2;
11652 SendMessageToSet(&data2, true);
11653 }
11654
11655 SendEnchantmentDurations(); // must be after add to map
11656 SendItemDurations(); // must be after add to map
11659
11660 // raid downscaling - send difficulty to player
11661 if (GetMap()->IsRaid())
11662 {
11664 {
11667 }
11668 }
11670 SendRaidDifficulty(GetGroup() != nullptr);
11671}
AuraType
Definition SpellAuraDefines.h:62
@ SPELL_AURA_FEATHER_FALL
Definition SpellAuraDefines.h:168
@ SPELL_AURA_FLY
Definition SpellAuraDefines.h:264
@ SPELL_AURA_WATER_WALK
Definition SpellAuraDefines.h:167
@ SPELL_AURA_HOVER
Definition SpellAuraDefines.h:169
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
@ SPELL_AURA_NONE
Definition SpellAuraDefines.h:63
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition SpellAuraDefines.h:43
void UpdateVisibilityForPlayer(bool mapChange=false)
Definition PlayerUpdates.cpp:1592
uint32 GetMountBlockId()
Definition Player.h:2620
void SendTaxiNodeStatusMultiple()
Definition Player.cpp:10495
Difficulty GetStoredRaidDifficulty() const
Definition Player.h:1936
void SendEnchantmentDurations()
Definition PlayerStorage.cpp:4733
void SendItemDurations()
Definition PlayerStorage.cpp:4749
void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty=-1)
Definition PlayerMisc.cpp:177
bool HasStunAura() const
Definition Unit.h:1753
bool HasMountedAura() const
Definition Unit.h:1713
bool HasRootAura() const
Definition Unit.h:1752
void SendTimeSync()
Definition WorldSession.cpp:1431
void ResetTimeSync()
Definition WorldSession.cpp:1425
@ SMSG_FORCE_MOVE_ROOT
Definition Opcodes.h:262

References Unit::AddAura(), AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Unit::CastSpell(), Unit::GetAuraEffectsByType(), GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetMountBlockId(), Object::GetPackGUID(), GetRaidDifficulty(), GetSession(), GetStoredRaidDifficulty(), WorldObject::GetZoneAndAreaId(), Unit::HasMountedAura(), Unit::HasRootAura(), Unit::HasStunAura(), isBeingLoaded(), MOVE_ROOT, WorldSession::ResetTimeSync(), SendEnchantmentDurations(), SendItemDurations(), SendMessageToSet(), SendQuestGiverStatusMultiple(), SendRaidDifficulty(), SendTaxiNodeStatusMultiple(), WorldSession::SendTimeSync(), SetMountBlockId(), SetMovement(), SMSG_FORCE_MOVE_ROOT, SPELL_AURA_FEATHER_FALL, SPELL_AURA_FLY, SPELL_AURA_HOVER, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_NONE, SPELL_AURA_SAFE_FALL, SPELL_AURA_TRANSFORM, SPELL_AURA_WATER_WALK, StoreRaidMapDifficulty(), UpdateVisibilityForPlayer(), and UpdateZone().

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendInitialPacketsBeforeAddToMap()

void Player::SendInitialPacketsBeforeAddToMap ( )

Pass 'this' as argument because we're not stored in ObjectAccessor yet

11548{
11551
11552 // guild bank list?
11553
11554 // Homebind
11555 WorldPacket data(SMSG_BINDPOINTUPDATE, 5 * 4);
11556 data << m_homebindX << m_homebindY << m_homebindZ;
11557 data << (uint32) m_homebindMapId;
11558 data << (uint32) m_homebindAreaId;
11559 GetSession()->SendPacket(&data);
11560
11561 // SMSG_SET_PROFICIENCY
11562 // SMSG_SET_PCT_SPELL_MODIFIER
11563 // SMSG_SET_FLAT_SPELL_MODIFIER
11564 // SMSG_UPDATE_AURA_DURATION
11565
11566 SendTalentsInfoData(false);
11567
11568 // SMSG_INSTANCE_DIFFICULTY
11569 data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4 + 4);
11570 data << uint32(GetMap()->GetDifficulty());
11571 data << uint32(GetMap()->GetEntry()->IsDynamicDifficultyMap() && GetMap()->IsHeroic()); // Raid dynamic difficulty
11572 GetSession()->SendPacket(&data);
11573
11575
11576 data.Initialize(SMSG_SEND_UNLEARN_SPELLS, 4);
11577 data << uint32(0); // count, for (count) uint32;
11578 GetSession()->SendPacket(&data);
11579
11583
11585
11586 data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
11587 data.AppendPackedTime(GameTime::GetGameTime().count());
11588 data << float(0.01666667f); // game speed
11589 data << uint32(0); // added in 3.1.2
11590 GetSession()->SendPacket(&data);
11591
11592 GetReputationMgr().SendForceReactions(); // SMSG_SET_FORCED_REACTIONS
11593
11594 // SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
11595 // SMSG_PET_GUIDS
11596 // SMSG_UPDATE_WORLD_STATE
11597 // SMSG_POWER_UPDATE
11598
11599 SetMover(this);
11600
11601 sScriptMgr->OnPlayerSendInitialPacketsBeforeAddToMap(this, data);
11602}
void SendAllAchievementData() const
Definition AchievementMgr.cpp:2377
void SendSocialList(Player *player, uint32 flags)
Definition SocialMgr.cpp:124
void SendInitialSpells()
Definition Player.cpp:2764
PlayerSocial * GetSocial()
Definition Player.h:1160
void SendInitialActionButtons() const
Definition Player.h:1856
void SendEquipmentSetList()
Definition Player.cpp:14444
void SetMover(Unit *target)
Definition Player.cpp:12862
void SendInitialReputations()
Definition ReputationMgr.cpp:211
void SendForceReactions()
Definition ReputationMgr.cpp:165
@ SMSG_INSTANCE_DIFFICULTY
Definition Opcodes.h:857
@ SMSG_BINDPOINTUPDATE
Definition Opcodes.h:371
@ SMSG_LOGIN_SETTIMESPEED
Definition Opcodes.h:96
@ SMSG_SEND_UNLEARN_SPELLS
Definition Opcodes.h:1084

References ByteBuffer::AppendPackedTime(), GetDifficulty(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMap(), GetReputationMgr(), GetSession(), GetSocial(), WorldPacket::Initialize(), m_achievementMgr, m_homebindAreaId, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_reputationMgr, AchievementMgr::SendAllAchievementData(), SendEquipmentSetList(), ReputationMgr::SendForceReactions(), SendInitialActionButtons(), ReputationMgr::SendInitialReputations(), SendInitialSpells(), WorldSession::SendPacket(), PlayerSocial::SendSocialList(), SendTalentsInfoData(), SetMover(), SMSG_BINDPOINTUPDATE, SMSG_INSTANCE_DIFFICULTY, SMSG_LOGIN_SETTIMESPEED, SMSG_SEND_UNLEARN_SPELLS, SOCIAL_FLAG_ALL, and sScriptMgr.

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendInitialSpells()

void Player::SendInitialSpells ( )
2765{
2766 uint32 curTime = GameTime::GetGameTimeMS().count();
2768
2769 uint16 spellCount = 0;
2770
2771 WorldPacket data(SMSG_INITIAL_SPELLS, (1 + 2 + 4 * m_spells.size() + 2 + m_spellCooldowns.size() * (4 + 2 + 2 + 4 + 4)));
2772 data << uint8(0);
2773
2774 std::size_t countPos = data.wpos();
2775 data << uint16(spellCount); // spell count placeholder
2776
2777 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
2778 {
2779 if (itr->second->State == PLAYERSPELL_REMOVED)
2780 continue;
2781
2782 if (!itr->second->Active || !itr->second->IsInSpec(GetActiveSpec()))
2783 continue;
2784
2785 data << uint32(itr->first);
2786 data << uint16(0); // it's not slot id
2787
2788 ++spellCount;
2789 }
2790
2791 // Added spells from glyphs too (needed by spell tooltips)
2792 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
2793 {
2794 if (uint32 glyph = GetGlyph(i))
2795 {
2796 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph))
2797 {
2798 data << uint32(glyphEntry->SpellId);
2799 data << uint16(0); // it's not slot id
2800
2801 ++spellCount;
2802 }
2803 }
2804 }
2805
2806 // xinef: we have to send talents, but not those on m_spells list
2807 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
2808 {
2809 if (itr->second->State == PLAYERSPELL_REMOVED)
2810 continue;
2811
2812 // xinef: remove all active talent auras
2813 if (!(itr->second->specMask & GetActiveSpecMask()))
2814 continue;
2815
2816 // xinef: already sent from m_spells
2817 if (itr->second->inSpellBook)
2818 continue;
2819
2820 data << uint32(itr->first);
2821 data << uint16(0); // it's not slot id
2822
2823 ++spellCount;
2824 }
2825
2826 data.put<uint16>(countPos, spellCount); // write real count value
2827
2828 uint16 spellCooldowns = m_spellCooldowns.size();
2829 data << uint16(spellCooldowns);
2830 for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
2831 {
2832 if (!itr->second.needSendToClient)
2833 continue;
2834
2835 SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first);
2836 if (!sEntry)
2837 continue;
2838
2839 data << uint32(itr->first);
2840
2841 data << uint16(itr->second.itemid); // cast item id
2842 data << uint16(itr->second.category); // spell category
2843
2844 // send infinity cooldown in special format
2845 if (itr->second.end >= infTime)
2846 {
2847 data << uint32(1); // cooldown
2848 data << uint32(0x80000000); // category cooldown
2849 continue;
2850 }
2851
2852 uint32 cooldown = itr->second.end > curTime ? itr->second.end - curTime : 0;
2853 data << uint32(itr->second.category ? 0 : cooldown); // cooldown
2854 data << uint32(itr->second.category ? cooldown : 0); // category cooldown
2855 }
2856
2857 GetSession()->SendPacket(&data);
2858}
@ SMSG_INITIAL_SPELLS
Definition Opcodes.h:328

References GetActiveSpec(), GetActiveSpecMask(), GameTime::GetGameTimeMS(), GetGlyph(), GetSession(), infinityCooldownDelayCheck, m_spellCooldowns, m_spells, m_talents, MAX_GLYPH_SLOT_INDEX, PLAYERSPELL_REMOVED, ByteBuffer::put(), WorldSession::SendPacket(), sGlyphPropertiesStore, SMSG_INITIAL_SPELLS, sSpellMgr, and ByteBuffer::wpos().

Referenced by SendInitialPacketsBeforeAddToMap().

◆ SendInitWorldStates()

void Player::SendInitWorldStates ( uint32  zoneId,
uint32  areaId 
)
8206{
8207 // data depends on zoneid/mapid...
8208 uint32 mapId = GetMapId();
8209 Battleground* battleground = GetBattleground();
8210 OutdoorPvP* outdoorPvP = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneId);
8211 InstanceScript* instance = GetInstanceScript();
8212 Battlefield* battlefield = sBattlefieldMgr->GetBattlefieldToZoneId(zoneId);
8213
8214 LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: {}, Zone: {}", mapId, zoneId);
8215
8217 packet.MapID = mapId;
8218 packet.ZoneID = zoneId;
8219 packet.AreaID = areaId;
8220
8221 packet.Worldstates.reserve(8);
8223 packet.Worldstates.emplace_back(WORLD_STATE_SCOURGE_INVASION_AZSHARA, 0);
8226 packet.Worldstates.emplace_back(WORLD_STATE_SCOURGE_INVASION_TANARIS, 0);
8228
8229 // 7 1 - Arena season in progress, 0 - end of season
8231 // 8 Arena season id
8232 packet.Worldstates.emplace_back(WORLD_STATE_ARENA_SEASON_ID, sArenaSeasonMgr->GetCurrentSeason());
8233
8234 if (mapId == MAP_OUTLAND)
8235 {
8236 packet.Worldstates.reserve(3);
8238 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_UI_GUARDS_MAX, 15);
8239 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT, 15);
8240 }
8241
8243 {
8244 Player::bgZoneIdToFillWorldStates[zoneId](battleground, packet);
8245 }
8246 else
8247 {
8248 // insert <field> <value>
8249 switch (zoneId)
8250 {
8251 case AREA_DUN_MOROGH:
8252 case AREA_WETLANDS:
8253 case AREA_ELWYNN_FOREST:
8254 case AREA_LOCH_MODAN:
8255 case AREA_WESTFALL:
8256 case AREA_SEARING_GORGE:
8258 case AREA_IRONFORGE:
8259 case AREA_DEEPRUN_TRAM:
8261 break;
8263 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_EP)
8264 outdoorPvP->FillInitialWorldStates(packet);
8265 else
8266 {
8267 packet.Worldstates.reserve(32);
8269 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_A, 0);
8270 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_H, 0);
8272 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_N, 50);
8273 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N, 1);
8276 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_7, 0);
8277 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_8, 0);
8278 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_A, 0);
8279 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_H, 0);
8280 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_EASTWALLTOWER_A, 0);
8281 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_EASTWALLTOWER_H, 0);
8282 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_0, 0);
8283 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_1, 0);
8284 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_A, 0);
8285 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_H, 0);
8286 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_EASTWALLTOWER_N, 1);
8287 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N, 1);
8290 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_2, 0);
8291 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_3, 0);
8292 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_NORTHPASSTOWER_A, 0);
8293 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_NORTHPASSTOWER_H, 0);
8294 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_N, 1);
8296 //packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_4, 1);
8297 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_5, 0);
8298 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_UNK_6, 0);
8299 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_A, 0);
8300 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_H, 0);
8301
8302 break;
8303 case AREA_SILITHUS:
8304 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_SI)
8305 outdoorPvP->FillInitialWorldStates(packet);
8306 else
8307 {
8308 packet.Worldstates.reserve(3);
8309 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_SI_GATHERED_A, 0);
8310 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_SI_GATHERED_H, 0);
8311 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_SI_SILITHYST_MAX, 0);
8312 }
8313 // unknown, aq opening?
8314 packet.Worldstates.reserve(4);
8315 packet.Worldstates.emplace_back(WORLD_STATE_AHNQIRAJ_SANDWORM_N, 0);
8316 packet.Worldstates.emplace_back(WORLD_STATE_AHNQIRAJ_SANDWORM_S, 0);
8317 packet.Worldstates.emplace_back(WORLD_STATE_AHNQIRAJ_SANDWORM_SW, 0);
8318 packet.Worldstates.emplace_back(WORLD_STATE_AHNQIRAJ_SANDWORM_E, 0);
8319 break;
8321 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_AV)
8322 battleground->FillInitialWorldStates(packet);
8323 else
8324 {
8325 packet.Worldstates.reserve(75);
8329 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_AID_A_A, 0);
8334 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_N_MINE_N, 1);
8340 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_5, 0);
8343 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_4, 0);
8348 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_3, 1);
8360 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_1, 0);
8361 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_0, 0);
8369 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_UNK_2, 0);
8378 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_N_MINE_H, 0);
8379 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_N_MINE_A, 0);
8380 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_S_MINE_N, 1);
8381 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_S_MINE_H, 0);
8382 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_S_MINE_A, 0);
8398 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_AID_H_A, 0);
8399 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_AID_H_C, 0);
8400 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AV_AID_A_C, 1);
8401 }
8402 break;
8403 case AREA_WARSONG_GULCH:
8404 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_WS)
8405 battleground->FillInitialWorldStates(packet);
8406 else
8407 {
8408 packet.Worldstates.reserve(8);
8411 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_WS_UNK_0, 0);
8412 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_WS_UNK_1, 0);
8413 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_WS_UNK_2, 2);
8417 }
8418 break;
8419 case AREA_ARATHI_BASIN:
8420 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_AB)
8421 battleground->FillInitialWorldStates(packet);
8422 else
8423 {
8424 packet.Worldstates.reserve(32);
8437 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AB_RESOURCES_MAX, 1600);
8453 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AB_FARM_ICON, 1);
8455 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AB_UNK, 2);
8456 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_AB_RESOURCES_WARNING, 1400); // warning limit (1400)
8457 }
8458 break;
8460 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_EY)
8461 battleground->FillInitialWorldStates(packet);
8462 else
8463 {
8464 packet.Worldstates.reserve(32);
8473 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_EY_UNK_2, 0);
8474 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_EY_UNK_1, 0);
8487 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_EY_FLAG, 1);
8492 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_EY_UNK_0, 142);
8496 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_EY_UNK_3, 379);
8497 // missing unknowns
8498 }
8499 break;
8500 // any of these needs change! the client remembers the prev setting!
8501 // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF!
8503 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_HP)
8504 outdoorPvP->FillInitialWorldStates(packet);
8505 else
8506 {
8507 packet.Worldstates.reserve(16);
8510 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_BROKENHILL_N, 0);
8511 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_BROKENHILL_H, 1);
8512 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_BROKENHILL_A, 0);
8513 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_OVERLOOK_N, 0);
8514 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_OVERLOOK_H, 1);
8515 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_OVERLOOK_A, 0);
8516 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_H, 0);
8517 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_A, 0);
8518 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_N, 100);
8521 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_STADIUM_N, 0);
8522 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_STADIUM_A, 0);
8523 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_HP_STADIUM_H, 1);
8524 }
8525 break;
8526 case AREA_NAGRAND:
8527 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_NA)
8528 outdoorPvP->FillInitialWorldStates(packet);
8529 else
8530 {
8531 packet.Worldstates.reserve(28);
8534 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_UI_GUARDS_MAX, 0);
8535 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT, 0);
8538 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_UI_SLIDER_N, 0);
8549 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_H, 0);
8550 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_A, 0);
8553 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_H, 0);
8554 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_A, 0);
8555 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_HALAA_NEUTRAL, 0);
8556 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_A, 0);
8557 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_H, 0);
8558 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_NA_MAP_HALAA_HORDE, 0);
8560 }
8561 break;
8563 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_TF)
8564 outdoorPvP->FillInitialWorldStates(packet);
8565 else
8566 {
8567 packet.Worldstates.reserve(28);
8569 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_N, 20);
8571 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_H, 0);
8572 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_A, 5);
8574 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_14, 0);
8575 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_13, 0);
8576 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_12, 0);
8577 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_11, 0);
8578 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_10, 0);
8579 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_09, 0);
8580 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_08, 0);
8581 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_07, 0);
8582 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_06, 0);
8583 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_15, 0);
8584 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_05, 0);
8585 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_04, 0);
8586 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_03, 0);
8587 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_02, 0);
8588 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_01, 0);
8589 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_TF_TOWER_NUM_00, 0);
8596 }
8597 break;
8598 case AREA_ZANGARMARSH:
8599 if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_ZM)
8600 outdoorPvP->FillInitialWorldStates(packet);
8601 else
8602 {
8603 packet.Worldstates.reserve(26);
8607 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UNK, 1);
8608 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_N, 0);
8609 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_H, 1);
8610 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_A, 0);
8611 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_H, 1);
8612 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_A, 0);
8613 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_N, 0);
8614 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_N, 0);
8615 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_H, 1);
8616 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_A, 0);
8620 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_N, 0);
8621 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_H, 1);
8622 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_A, 0);
8623 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_N, 0);
8624 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_H, 1);
8625 packet.Worldstates.emplace_back(WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_A, 0);
8630 }
8631 break;
8632 case AREA_NAGRAND_ARENA:
8633 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_NA)
8634 battleground->FillInitialWorldStates(packet);
8635 else
8636 {
8637 packet.Worldstates.reserve(3);
8641 }
8642 break;
8644 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_BE)
8645 battleground->FillInitialWorldStates(packet);
8646 else
8647 {
8648 packet.Worldstates.reserve(3);
8652 }
8653 break;
8655 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_RL)
8656 battleground->FillInitialWorldStates(packet);
8657 else
8658 {
8659 packet.Worldstates.reserve(3);
8663 }
8664 break;
8665 case AREA_DALARAN_ARENA:
8666 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_DS)
8667 battleground->FillInitialWorldStates(packet);
8668 else
8669 {
8670 packet.Worldstates.reserve(3);
8674 }
8675 break;
8677 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_SA)
8678 battleground->FillInitialWorldStates(packet);
8679 else
8680 {
8681 packet.Worldstates.reserve(24);
8685 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_SA_BLUE_GATE, 0);
8686 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_SA_RED_GATE, 0);
8691
8692 // End Round timer, example: 19:59 -> A:BC
8695 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_SA_TIMER_MINUTES, 0); // A
8696
8709 // missing unknowns
8710 }
8711 break;
8713 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_RV)
8714 battleground->FillInitialWorldStates(packet);
8715 else
8716 {
8717 packet.Worldstates.reserve(3);
8721 }
8722 break;
8724 if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_IC)
8725 battleground->FillInitialWorldStates(packet);
8726 else
8727 {
8728 packet.Worldstates.reserve(18);
8745 packet.Worldstates.emplace_back(WORLD_STATE_BATTLEGROUND_IC_UNK, 1);
8747 }
8748 break;
8750 if (instance)
8751 instance->FillInitialWorldStates(packet);
8752 else
8753 {
8754 packet.Worldstates.reserve(3);
8758 }
8759 break;
8761 if (instance && mapId == MAP_ICECROWN_CITADEL)
8762 instance->FillInitialWorldStates(packet);
8763 else
8764 {
8765 packet.Worldstates.reserve(5);
8771 }
8772 break;
8774 if (instance && mapId == MAP_THE_CULLING_OF_STRATHOLME)
8775 instance->FillInitialWorldStates(packet);
8776 else
8777 {
8778 packet.Worldstates.reserve(5);
8784 }
8785 break;
8786 case AREA_THE_OCULUS:
8787 if (instance && mapId == MAP_THE_OCULUS)
8788 instance->FillInitialWorldStates(packet);
8789 else
8790 {
8791 packet.Worldstates.reserve(2);
8794 }
8795 break;
8796 case AREA_ULDUAR:
8797 if (instance && mapId == MAP_ULDUAR)
8798 instance->FillInitialWorldStates(packet);
8799 else
8800 {
8801 packet.Worldstates.reserve(2);
8804 }
8805 break;
8807 if (instance)
8808 instance->FillInitialWorldStates(packet);
8809 else
8810 {
8811 packet.Worldstates.reserve(3);
8812 packet.Worldstates.emplace_back(WORLD_STATE_VIOLET_HOLD_SHOW, 0);
8813 packet.Worldstates.emplace_back(WORLD_STATE_VIOLET_HOLD_PRISON_STATE, 100);
8814 packet.Worldstates.emplace_back(WORLD_STATE_VIOLET_HOLD_WAVE_COUNT, 0);
8815 }
8816 break;
8818 if (instance && mapId == MAP_HALLS_OF_REFLECTION)
8819 instance->FillInitialWorldStates(packet);
8820 else
8821 {
8822 packet.Worldstates.reserve(2);
8825 }
8826 break;
8827 case AREA_PLAGUELANDS_THE_SCARLET_ENCLAVE: // (DK starting zone)
8828 // Get Mograine, GUID and ENTRY should NEVER change
8829 if (Creature* mograine = ObjectAccessor::GetCreature(*this, ObjectGuid::Create<HighGuid::Unit>(29173, 130956)))
8830 {
8831 if (CreatureAI* mograineAI = mograine->AI())
8832 {
8833 packet.Worldstates.reserve(6);
8834 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_DEFENDERS_COUNT, mograineAI->GetData(3590));
8835 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SCOURGE_COUNT, mograineAI->GetData(3591));
8836 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SOLDIERS_ENABLE, mograineAI->GetData(3592));
8837 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_ENABLE, mograineAI->GetData(3603));
8838 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_TIME, mograineAI->GetData(3604));
8839 packet.Worldstates.emplace_back(WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_EVENT_BEGIN_ENABLE, mograineAI->GetData(3605));
8840 }
8841 }
8842 break;
8843 case AREA_WINTERGRASP:
8844 if (battlefield && battlefield->GetTypeId() == BATTLEFIELD_WG)
8845 {
8846 battlefield->FillInitialWorldStates(packet);
8847 break;
8848 }
8849 default:
8850 break;
8851 }
8852 }
8853 }
8854
8855 sWorldState->FillInitialWorldStates(packet, zoneId, areaId);
8856 SendDirectMessage(packet.Write());
8859}
@ MAP_THE_CULLING_OF_STRATHOLME
Definition AreaDefines.h:249
@ MAP_ICECROWN_CITADEL
Definition AreaDefines.h:265
@ MAP_THE_OCULUS
Definition AreaDefines.h:246
@ MAP_HALLS_OF_REFLECTION
Definition AreaDefines.h:270
@ MAP_OUTLAND
Definition AreaDefines.h:216
@ MAP_ULDUAR
Definition AreaDefines.h:254
@ AREA_PLAGUELANDS_THE_SCARLET_ENCLAVE
Definition AreaDefines.h:147
@ ARENA_THE_RING_OF_VALOR
Definition AreaDefines.h:151
@ AREA_THE_RUBY_SANCTUM
Definition AreaDefines.h:180
@ AREA_WETLANDS
Definition AreaDefines.h:30
@ AREA_IRONFORGE
Definition AreaDefines.h:82
@ AREA_STRAND_OF_THE_ANCIENTS
Definition AreaDefines.h:149
@ AREA_WESTFALL
Definition AreaDefines.h:39
@ AREA_WARSONG_GULCH
Definition AreaDefines.h:92
@ AREA_NAGRAND
Definition AreaDefines.h:99
@ AREA_THE_VIOLET_HOLD
Definition AreaDefines.h:152
@ AREA_RUINS_OF_LORDAERON
Definition AreaDefines.h:136
@ AREA_HALLS_OF_REFLECTION
Definition AreaDefines.h:174
@ AREA_LOCH_MODAN
Definition AreaDefines.h:38
@ AREA_DEEPRUN_TRAM
Definition AreaDefines.h:89
@ AREA_SILITHUS
Definition AreaDefines.h:79
@ AREA_ICECROWN_CITADEL
Definition AreaDefines.h:173
@ AREA_ARATHI_BASIN
Definition AreaDefines.h:93
@ AREA_EASTERN_PLAGUELANDS
Definition AreaDefines.h:53
@ AREA_DUN_MOROGH
Definition AreaDefines.h:25
@ AREA_STORMWIND_CITY
Definition AreaDefines.h:81
@ AREA_THE_CULLING_OF_STRATHOLME
Definition AreaDefines.h:140
@ AREA_NAGRAND_ARENA
Definition AreaDefines.h:115
@ AREA_SHATTRATH_CITY
Definition AreaDefines.h:117
@ AREA_EYE_OF_THE_STORM
Definition AreaDefines.h:130
@ AREA_ALTERAC_VALLEY
Definition AreaDefines.h:90
@ AREA_BLADES_EDGE_ARENA
Definition AreaDefines.h:116
@ AREA_ULDUAR
Definition AreaDefines.h:146
@ AREA_ISLE_OF_CONQUEST
Definition AreaDefines.h:172
@ AREA_DALARAN_ARENA
Definition AreaDefines.h:148
@ AREA_SEARING_GORGE
Definition AreaDefines.h:44
@ AREA_ELWYNN_FOREST
Definition AreaDefines.h:31
@ AREA_ZANGARMARSH
Definition AreaDefines.h:102
@ AREA_THE_OCULUS
Definition AreaDefines.h:145
@ AREA_TEROKKAR_FOREST
Definition AreaDefines.h:100
@ ARENA_SEASON_STATE_IN_PROGRESS
Definition ArenaSeasonMgr.h:29
#define sArenaSeasonMgr
Definition ArenaSeasonMgr.h:124
@ BATTLEFIELD_WG
Definition Battlefield.h:29
@ OUTDOOR_PVP_SI
Definition OutdoorPvP.h:34
@ OUTDOOR_PVP_TF
Definition OutdoorPvP.h:32
@ OUTDOOR_PVP_ZM
Definition OutdoorPvP.h:33
@ OUTDOOR_PVP_EP
Definition OutdoorPvP.h:35
@ OUTDOOR_PVP_NA
Definition OutdoorPvP.h:31
@ OUTDOOR_PVP_HP
Definition OutdoorPvP.h:30
@ BATTLEGROUND_IC
Definition SharedDefines.h:3747
@ BATTLEGROUND_WS
Definition SharedDefines.h:3737
@ BATTLEGROUND_EY
Definition SharedDefines.h:3742
@ BATTLEGROUND_AV
Definition SharedDefines.h:3736
@ BATTLEGROUND_BE
Definition SharedDefines.h:3740
@ BATTLEGROUND_RV
Definition SharedDefines.h:3746
@ BATTLEGROUND_NA
Definition SharedDefines.h:3739
@ BATTLEGROUND_DS
Definition SharedDefines.h:3745
@ BATTLEGROUND_SA
Definition SharedDefines.h:3744
@ BATTLEGROUND_AB
Definition SharedDefines.h:3738
@ BATTLEGROUND_RL
Definition SharedDefines.h:3743
@ WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_N
Definition WorldStateDefines.h:427
@ WORLD_STATE_OPVP_EP_UNK_1
Definition WorldStateDefines.h:388
@ WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_SHOW
Definition WorldStateDefines.h:215
@ WORLD_STATE_SCOURGE_INVASION_EASTERN_PLAGUELANDS
Definition WorldStateDefines.h:32
@ WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_CONTROLLED_HORDE
Definition WorldStateDefines.h:184
@ WORLD_STATE_OPVP_HP_UI_TOWER_DISPLAY_H
Definition WorldStateDefines.h:412
@ WORLD_STATE_BATTLEGROUND_SA_TIMER_MINUTES
Definition WorldStateDefines.h:304
@ WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_DISPLAY
Definition WorldStateDefines.h:384
@ WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT
Definition WorldStateDefines.h:474
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_H
Definition WorldStateDefines.h:482
@ WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_ALLIANCE
Definition WorldStateDefines.h:202
@ WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_H_A
Definition WorldStateDefines.h:107
@ WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_ALLIANCE
Definition WorldStateDefines.h:198
@ WORLD_STATE_AHNQIRAJ_SANDWORM_S
Definition WorldStateDefines.h:510
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_ASSAULTED
Definition WorldStateDefines.h:153
@ WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_ALLIANCE_CONFLICT
Definition WorldStateDefines.h:231
@ WORLD_STATE_SCOURGE_INVASION_BLASTED_LANDS
Definition WorldStateDefines.h:29
@ WORLD_STATE_BATTLEGROUND_SA_LEFT_ATTACK_TOKEN_ALLIANCE
Definition WorldStateDefines.h:314
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_NEU_H
Definition WorldStateDefines.h:498
@ WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_N
Definition WorldStateDefines.h:431
@ WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_ALLIANCE_CONTROL
Definition WorldStateDefines.h:228
@ WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_UNCONTROL
Definition WorldStateDefines.h:224
@ WORLD_STATE_BATTLEGROUND_AV_DUNS_CONTROLLED
Definition WorldStateDefines.h:126
@ WORLD_STATE_BATTLEGROUND_SA_RED_GATE
Definition WorldStateDefines.h:311
@ WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_N
Definition WorldStateDefines.h:403
@ WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_N
Definition WorldStateDefines.h:365
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_POS_E
Definition WorldStateDefines.h:420
@ WORLD_STATE_BATTLEGROUND_SA_TIMER_SECONDS_SECOND_DIGIT
Definition WorldStateDefines.h:306
@ WORLD_STATE_BATTLEGROUND_SA_PURPLE_GATE
Definition WorldStateDefines.h:310
@ WORLD_STATE_AHNQIRAJ_SANDWORM_E
Definition WorldStateDefines.h:512
@ WORLD_STATE_BATTLEGROUND_SA_YELLOW_GATE
Definition WorldStateDefines.h:326
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_A_A
Definition WorldStateDefines.h:118
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_DESTROYED
Definition WorldStateDefines.h:133
@ WORLD_STATE_BATTLEGROUND_AB_RESOURCES_ALLIANCE
Definition WorldStateDefines.h:189
@ WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED
Definition WorldStateDefines.h:567
@ WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_CONTROLLED_ALLIANCE
Definition WorldStateDefines.h:196
@ WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_UNCONTROL
Definition WorldStateDefines.h:221
@ WORLD_STATE_BATTLEGROUND_AV_AID_H_A
Definition WorldStateDefines.h:99
@ WORLD_STATE_BATTLEGROUND_IC_REFINERY_UNCONTROLLED
Definition WorldStateDefines.h:274
@ WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_N
Definition WorldStateDefines.h:452
@ WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_H
Definition WorldStateDefines.h:426
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SOLDIERS_ENABLE
Definition WorldStateDefines.h:517
@ WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_N_A
Definition WorldStateDefines.h:375
@ WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_ALLIANCE_CONTROL
Definition WorldStateDefines.h:219
@ WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_HORDE
Definition WorldStateDefines.h:203
@ WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_UNCONTROL
Definition WorldStateDefines.h:227
@ WORLD_STATE_OPVP_HP_BROKENHILL_A
Definition WorldStateDefines.h:409
@ WORLD_STATE_BATTLEGROUND_SA_CENTER_GY_ALLIANCE
Definition WorldStateDefines.h:325
@ WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_HORDE
Definition WorldStateDefines.h:186
@ WORLD_STATE_BATTLEGROUND_NA_ARENA_GREEN
Definition WorldStateDefines.h:338
@ WORLD_STATE_OPVP_TF_TOWER_NUM_10
Definition WorldStateDefines.h:465
@ WORLD_STATE_BATTLEGROUND_AV_STONEHEART_H_C
Definition WorldStateDefines.h:92
@ WORLD_STATE_BATTLEGROUND_AV_STONEH_ASSAULTED
Definition WorldStateDefines.h:146
@ WORLD_STATE_BATTLEGROUND_AV_UNK_4
Definition WorldStateDefines.h:156
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_A_C
Definition WorldStateDefines.h:108
@ WORLD_STATE_BATTLEGROUND_SA_ENABLE_TIMER
Definition WorldStateDefines.h:307
@ WORLD_STATE_BATTLEGROUND_AV_DUNS_ASSAULTED
Definition WorldStateDefines.h:143
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_EVENT_BEGIN_ENABLE
Definition WorldStateDefines.h:520
@ WORLD_STATE_OCULUS_CENTRIFUGE_CONSTRUCT_AMOUNT
Definition WorldStateDefines.h:562
@ WORLD_STATE_BATTLEGROUND_EY_FLAG
Definition WorldStateDefines.h:244
@ WORLD_STATE_BATTLEGROUND_EY_ALLIANCE_RESOURCES
Definition WorldStateDefines.h:240
@ WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_ICON
Definition WorldStateDefines.h:208
@ WORLD_STATE_BATTLEGROUND_BE_ARENA_GOLD
Definition WorldStateDefines.h:332
@ WORLD_STATE_OPVP_TF_UI_TOWERS_CONTROLLED_DISPLAY
Definition WorldStateDefines.h:448
@ WORLD_STATE_BATTLEGROUND_AV_S_MINE_N
Definition WorldStateDefines.h:122
@ WORLD_STATE_OPVP_TF_TOWER_NUM_05
Definition WorldStateDefines.h:459
@ WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_CONTROLLED_HORDE
Definition WorldStateDefines.h:188
@ WORLD_STATE_OPVP_ZM_MAP_HORDE_FLAG_READY
Definition WorldStateDefines.h:441
@ WORLD_STATE_BATTLEGROUND_AV_AID_H_C
Definition WorldStateDefines.h:98
@ WORLD_STATE_BATTLEGROUND_EY_UNK_2
Definition WorldStateDefines.h:238
@ WORLD_STATE_OPVP_EP_UNK_3
Definition WorldStateDefines.h:390
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_NEU_A
Definition WorldStateDefines.h:492
@ WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_CONTROLLED_HORDE
Definition WorldStateDefines.h:197
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_H_A
Definition WorldStateDefines.h:119
@ WORLD_STATE_OPVP_NA_UI_HORDE_GUARDS_SHOW
Definition WorldStateDefines.h:480
@ WORLD_STATE_SCOURGE_INVASION_BURNING_STEPPES
Definition WorldStateDefines.h:30
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_A
Definition WorldStateDefines.h:486
@ WORLD_STATE_BATTLEGROUND_WS_UNK_0
Definition WorldStateDefines.h:169
@ WORLD_STATE_BATTLEGROUND_SA_HORDE_ATTACKER
Definition WorldStateDefines.h:308
@ WORLD_STATE_BATTLEGROUND_SA_RIGHT_ATTACK_TOKEN_HORDE
Definition WorldStateDefines.h:316
@ WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_H_WS_OPEN
Definition WorldStateDefines.h:284
@ WORLD_STATE_BATTLEGROUND_AV_N_MINE_N
Definition WorldStateDefines.h:125
@ WORLD_STATE_OPVP_EP_UNK_0
Definition WorldStateDefines.h:387
@ WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_A_C
Definition WorldStateDefines.h:112
@ WORLD_STATE_OPVP_TF_TOWER_NUM_04
Definition WorldStateDefines.h:458
@ WORLD_STATE_OPVP_SI_SILITHYST_MAX
Definition WorldStateDefines.h:359
@ WORLD_STATE_OPVP_HP_OVERLOOK_N
Definition WorldStateDefines.h:408
@ WORLD_STATE_BATTLEGROUND_IC_HORDE_KEEP_CONTROLLED_H
Definition WorldStateDefines.h:297
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_H
Definition WorldStateDefines.h:487
@ WORLD_STATE_ICECROWN_CITADEL_ATTEMPTS_REMAINING
Definition WorldStateDefines.h:551
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_H
Definition WorldStateDefines.h:429
@ WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_N
Definition WorldStateDefines.h:424
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_UNUSED
Definition WorldStateDefines.h:160
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_DISPLAY_E
Definition WorldStateDefines.h:419
@ WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N_A
Definition WorldStateDefines.h:373
@ WORLD_STATE_BATTLEGROUND_AV_DUNN_DESTROYED
Definition WorldStateDefines.h:136
@ WORLD_STATE_BATTLEGROUND_EY_ALLIANCE_BASE
Definition WorldStateDefines.h:242
@ WORLD_STATE_OPVP_TF_TOWER_NUM_12
Definition WorldStateDefines.h:467
@ WORLD_STATE_BATTLEGROUND_AV_UNK_1
Definition WorldStateDefines.h:91
@ WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER
Definition WorldStateDefines.h:566
@ WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT
Definition WorldStateDefines.h:446
@ WORLD_STATE_AHNQIRAJ_SANDWORM_N
Definition WorldStateDefines.h:509
@ WORLD_STATE_BATTLEGROUND_AB_RESOURCES_WARNING
Definition WorldStateDefines.h:212
@ WORLD_STATE_OPVP_TF_TOWER_NUM_00
Definition WorldStateDefines.h:454
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_CONTROLLED
Definition WorldStateDefines.h:147
@ WORLD_STATE_BATTLEGROUND_AV_UNK_2
Definition WorldStateDefines.h:134
@ WORLD_STATE_BATTLEGROUND_EY_UNK_3
Definition WorldStateDefines.h:239
@ WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_HORDE_CONTROL
Definition WorldStateDefines.h:229
@ WORLD_STATE_BATTLEGROUND_AV_ICEWING_ASSAULTED
Definition WorldStateDefines.h:145
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_H_A
Definition WorldStateDefines.h:103
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_H_A
Definition WorldStateDefines.h:111
@ WORLD_STATE_BATTLEGROUND_AV_DUNN_ASSAULTED
Definition WorldStateDefines.h:144
@ WORLD_STATE_BATTLEGROUND_AV_STONEH_CONTROLLED
Definition WorldStateDefines.h:129
@ WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_HOURS
Definition WorldStateDefines.h:445
@ WORLD_STATE_VIOLET_HOLD_SHOW
Definition WorldStateDefines.h:572
@ WORLD_STATE_BATTLEGROUND_AV_STORMPIKE_COMMANDERS
Definition WorldStateDefines.h:89
@ WORLD_STATE_BATTLEGROUND_IC_WORKSHOP_UNCONTROLLED
Definition WorldStateDefines.h:258
@ WORLD_STATE_BATTLEGROUND_SA_RIGHT_GY_ALLIANCE
Definition WorldStateDefines.h:324
@ WORLD_STATE_BATTLEGROUND_SA_LEFT_GY_ALLIANCE
Definition WorldStateDefines.h:323
@ WORLD_STATE_ICECROWN_CITADEL_ATTEMPTS_MAX
Definition WorldStateDefines.h:552
@ WORLD_STATE_BATTLEGROUND_SA_LEFT_ATTACK_TOKEN_HORDE
Definition WorldStateDefines.h:317
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_NEU_A
Definition WorldStateDefines.h:484
@ WORLD_STATE_BATTLEGROUND_AV_STONEHEART_A_C
Definition WorldStateDefines.h:93
@ WORLD_STATE_BATTLEGROUND_IC_HANGAR_UNCONTROLLED
Definition WorldStateDefines.h:259
@ WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N_H
Definition WorldStateDefines.h:374
@ WORLD_STATE_BATTLEGROUND_AV_DUNS_UNUSED
Definition WorldStateDefines.h:140
@ WORLD_STATE_BATTLEGROUND_IC_GATE_EAST_H_WS_OPEN
Definition WorldStateDefines.h:282
@ WORLD_STATE_BATTLEGROUND_AB_OCCUPIED_BASES_ALLIANCE
Definition WorldStateDefines.h:192
@ WORLD_STATE_BATTLEGROUND_WS_UNK_1
Definition WorldStateDefines.h:170
@ WORLD_STATE_BATTLEGROUND_AV_DUNN_UNUSED
Definition WorldStateDefines.h:139
@ WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_HORDE_CONTROL
Definition WorldStateDefines.h:220
@ WORLD_STATE_CULLING_OF_STRATHOLME_CRATES_REVEALED
Definition WorldStateDefines.h:556
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_A_C
Definition WorldStateDefines.h:100
@ WORLD_STATE_BATTLEGROUND_SA_BLUE_GATE
Definition WorldStateDefines.h:312
@ WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_ASSAULTED
Definition WorldStateDefines.h:154
@ WORLD_STATE_BATTLEGROUND_DS_ARENA_SHOW
Definition WorldStateDefines.h:349
@ WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N_H
Definition WorldStateDefines.h:381
@ WORLD_STATE_BATTLEGROUND_AV_ICEWING_CONTROLLED
Definition WorldStateDefines.h:128
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_UNUSED
Definition WorldStateDefines.h:157
@ WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_A
Definition WorldStateDefines.h:404
@ WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_HORDE
Definition WorldStateDefines.h:182
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_H
Definition WorldStateDefines.h:435
@ WORLD_STATE_OPVP_NA_UI_TOWER_SLIDER_POS
Definition WorldStateDefines.h:476
@ WORLD_STATE_BATTLEGROUND_RV_ARENA_SHOW
Definition WorldStateDefines.h:354
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_H_C
Definition WorldStateDefines.h:101
@ WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_DISPLAY
Definition WorldStateDefines.h:401
@ WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_CONTROLLED_HORDE
Definition WorldStateDefines.h:201
@ WORLD_STATE_BATTLEGROUND_SA_RIGHT_GY_HORDE
Definition WorldStateDefines.h:320
@ WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_A
Definition WorldStateDefines.h:370
@ WORLD_STATE_OPVP_TF_TOWER_NUM_11
Definition WorldStateDefines.h:466
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_CONTROLLED
Definition WorldStateDefines.h:148
@ WORLD_STATE_ICECROWN_CITADEL_EXECUTION_TIME
Definition WorldStateDefines.h:549
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_A_A
Definition WorldStateDefines.h:110
@ WORLD_STATE_BATTLEGROUND_RL_ARENA_GREEN
Definition WorldStateDefines.h:343
@ WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_POS
Definition WorldStateDefines.h:385
@ WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_CONTROLLED_ALLIANCE
Definition WorldStateDefines.h:187
@ WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_TOGGLE
Definition WorldStateDefines.h:545
@ WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_H_WS_CLOSED
Definition WorldStateDefines.h:279
@ WORLD_STATE_SCOURGE_INVASION_TANARIS
Definition WorldStateDefines.h:31
@ WORLD_STATE_OPVP_HP_STADIUM_H
Definition WorldStateDefines.h:398
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_A_A
Definition WorldStateDefines.h:102
@ WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_H_C
Definition WorldStateDefines.h:113
@ WORLD_STATE_BATTLEGROUND_WS_FLAG_STATE_HORDE
Definition WorldStateDefines.h:175
@ WORLD_STATE_BATTLEGROUND_AV_DUNN_CONTROLLED
Definition WorldStateDefines.h:127
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_DESTROYED
Definition WorldStateDefines.h:131
@ WORLD_STATE_BATTLEGROUND_AB_RESOURCES_MAX
Definition WorldStateDefines.h:193
@ WORLD_STATE_OPVP_HP_STADIUM_N
Definition WorldStateDefines.h:400
@ WORLD_STATE_BATTLEGROUND_EY_UNK_1
Definition WorldStateDefines.h:237
@ WORLD_STATE_BATTLEGROUND_AV_STORMPIKE_LIEUTENANTS
Definition WorldStateDefines.h:88
@ WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_A
Definition WorldStateDefines.h:425
@ WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_HORDE_CONFLICT
Definition WorldStateDefines.h:230
@ WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_A
Definition WorldStateDefines.h:362
@ WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_HORDE_CONFLICT
Definition WorldStateDefines.h:233
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_DEFENDERS_COUNT
Definition WorldStateDefines.h:515
@ WORLD_STATE_BATTLEGROUND_EY_HORDE_BASE
Definition WorldStateDefines.h:243
@ WORLD_STATE_OPVP_EP_UNK_5
Definition WorldStateDefines.h:392
@ WORLD_STATE_OPVP_EP_EASTWALLTOWER_H
Definition WorldStateDefines.h:369
@ WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_A
Definition WorldStateDefines.h:496
@ WORLD_STATE_BATTLEGROUND_IC_ALLIANCE_REINFORCEMENT
Definition WorldStateDefines.h:251
@ WORLD_STATE_OPVP_SI_GATHERED_H
Definition WorldStateDefines.h:358
@ WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N_A
Definition WorldStateDefines.h:380
@ WORLD_STATE_OPVP_ZM_MAP_ALLIANCE_FLAG_READY
Definition WorldStateDefines.h:438
@ WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_ALLIANCE
Definition WorldStateDefines.h:172
@ WORLD_STATE_BATTLEGROUND_AV_UNK_0
Definition WorldStateDefines.h:90
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_NEU_A
Definition WorldStateDefines.h:481
@ WORLD_STATE_OPVP_ZM_MAP_HORDE_FLAG_NOT_READY
Definition WorldStateDefines.h:440
@ WORLD_STATE_BATTLEGROUND_AV_AID_A_A
Definition WorldStateDefines.h:97
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_NEU_A
Definition WorldStateDefines.h:489
@ WORLD_STATE_BATTLEGROUND_EY_UNK_0
Definition WorldStateDefines.h:236
@ WORLD_STATE_BATTLEGROUND_SA_GREEN_GATE
Definition WorldStateDefines.h:313
@ WORLD_STATE_OPVP_TF_TOWER_NUM_09
Definition WorldStateDefines.h:464
@ WORLD_STATE_BATTLEGROUND_NA_ARENA_SHOW
Definition WorldStateDefines.h:339
@ WORLD_STATE_OPVP_TF_TOWER_NUM_13
Definition WorldStateDefines.h:468
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_A
Definition WorldStateDefines.h:434
@ WORLD_STATE_BATTLEGROUND_AV_STONEH_DESTROYED
Definition WorldStateDefines.h:138
@ WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN
Definition WorldStateDefines.h:558
@ WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_ICON
Definition WorldStateDefines.h:207
@ WORLD_STATE_BATTLEGROUND_RV_ARENA_GREEN
Definition WorldStateDefines.h:352
@ WORLD_STATE_BATTLEGROUND_AV_N_MINE_A
Definition WorldStateDefines.h:123
@ WORLD_STATE_OPVP_TF_TOWER_NUM_08
Definition WorldStateDefines.h:463
@ WORLD_STATE_OPVP_TF_TOWER_NUM_06
Definition WorldStateDefines.h:461
@ WORLD_STATE_BATTLEGROUND_AB_RESOURCES_HORDE
Definition WorldStateDefines.h:190
@ WORLD_STATE_BATTLEGROUND_IC_HORDE_REINFORCEMENT
Definition WorldStateDefines.h:252
@ WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_ALLIANCE_CONFLICT
Definition WorldStateDefines.h:232
@ WORLD_STATE_BATTLEGROUND_AV_STONEHEART_H_A
Definition WorldStateDefines.h:94
@ WORLD_STATE_BATTLEGROUND_AB_FARM_ICON
Definition WorldStateDefines.h:209
@ WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_HORDE
Definition WorldStateDefines.h:471
@ WORLD_STATE_SCOURGE_INVASION_WINTERSPRING
Definition WorldStateDefines.h:27
@ WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_CONTROLLED
Definition WorldStateDefines.h:149
@ WORLD_STATE_BATTLEGROUND_WS_UNK_2
Definition WorldStateDefines.h:171
@ WORLD_STATE_BATTLEGROUND_SA_LEFT_GY_HORDE
Definition WorldStateDefines.h:321
@ WORLD_STATE_OPVP_NA_MAP_HALAA_ALLIANCE
Definition WorldStateDefines.h:495
@ WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_CONTROLLED_ALLIANCE
Definition WorldStateDefines.h:183
@ WORLD_STATE_BATTLEGROUND_IC_GATE_EAST_A_WS_OPEN
Definition WorldStateDefines.h:287
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_NEU_H
Definition WorldStateDefines.h:499
@ WORLD_STATE_OPVP_HP_BROKENHILL_N
Definition WorldStateDefines.h:411
@ WORLD_STATE_BATTLEGROUND_IC_GATE_WEST_H_WS_OPEN
Definition WorldStateDefines.h:283
@ WORLD_STATE_ICECROWN_CITADEL_SHOW_ATTEMPTS
Definition WorldStateDefines.h:550
@ WORLD_STATE_OPVP_HP_UI_TOWER_DISPLAY_A
Definition WorldStateDefines.h:413
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_ASSAULTED
Definition WorldStateDefines.h:152
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_TIME
Definition WorldStateDefines.h:519
@ WORLD_STATE_BATTLEGROUND_AV_S_MINE_H
Definition WorldStateDefines.h:121
@ WORLD_STATE_BATTLEGROUND_SA_RIGHT_ATTACK_TOKEN_ALLIANCE
Definition WorldStateDefines.h:315
@ WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N
Definition WorldStateDefines.h:364
@ WORLD_STATE_BATTLEGROUND_AV_STONEHEART_A_A
Definition WorldStateDefines.h:95
@ WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_H
Definition WorldStateDefines.h:383
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_N_E
Definition WorldStateDefines.h:421
@ WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_ALLIANCE
Definition WorldStateDefines.h:470
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_A
Definition WorldStateDefines.h:491
@ WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_HORDE
Definition WorldStateDefines.h:199
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_H
Definition WorldStateDefines.h:485
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_N
Definition WorldStateDefines.h:430
@ WORLD_STATE_OPVP_TF_TOWER_NUM_03
Definition WorldStateDefines.h:457
@ WORLD_STATE_OPVP_EP_UNK_8
Definition WorldStateDefines.h:395
@ WORLD_STATE_BATTLEGROUND_SA_CENTER_GY_HORDE
Definition WorldStateDefines.h:322
@ WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_CONTROLLED_HORDE
Definition WorldStateDefines.h:205
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_H_C
Definition WorldStateDefines.h:109
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_CONTROLLED
Definition WorldStateDefines.h:150
@ WORLD_STATE_CULLING_OF_STRATHOLME_SHOW_CRATES
Definition WorldStateDefines.h:555
@ WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_A
Definition WorldStateDefines.h:376
@ WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_ALLIANCE_CONTROL
Definition WorldStateDefines.h:222
@ WORLD_STATE_OPVP_EP_UNK_6
Definition WorldStateDefines.h:393
@ WORLD_STATE_OPVP_HP_OVERLOOK_H
Definition WorldStateDefines.h:407
@ WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_A_A
Definition WorldStateDefines.h:114
@ WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT
Definition WorldStateDefines.h:557
@ WORLD_STATE_OPVP_ZM_MAP_ALLIANCE_FLAG_NOT_READY
Definition WorldStateDefines.h:439
@ WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT
Definition WorldStateDefines.h:447
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_UNUSED
Definition WorldStateDefines.h:158
@ WORLD_STATE_BATTLEGROUND_SA_TIMER_SECONDS_FIRST_DIGIT
Definition WorldStateDefines.h:305
@ WORLD_STATE_OPVP_NA_UI_SLIDER_N
Definition WorldStateDefines.h:478
@ WORLD_STATE_BATTLEGROUND_AV_ICEWING_DESTROYED
Definition WorldStateDefines.h:137
@ WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_HORDE_CONFLICT
Definition WorldStateDefines.h:235
@ WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_H
Definition WorldStateDefines.h:377
@ WORLD_STATE_BATTLEGROUND_EY_FLAG_STATE_HORDE
Definition WorldStateDefines.h:246
@ WORLD_STATE_HALLS_OF_REFLECTION_WAVES_ENABLED
Definition WorldStateDefines.h:576
@ WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_A_WS_OPEN
Definition WorldStateDefines.h:285
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_N
Definition WorldStateDefines.h:436
@ WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_DISPLAY
Definition WorldStateDefines.h:451
@ WORLD_STATE_BATTLEGROUND_RL_ARENA_SHOW
Definition WorldStateDefines.h:344
@ WORLD_STATE_OPVP_NA_UI_TOWER_SLIDER_DISPLAY
Definition WorldStateDefines.h:477
@ WORLD_STATE_OPVP_TF_TOWER_NUM_01
Definition WorldStateDefines.h:455
@ WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_DESTROYED
Definition WorldStateDefines.h:130
@ WORLD_STATE_OPVP_EP_EASTWALLTOWER_N
Definition WorldStateDefines.h:372
@ WORLD_STATE_BATTLEGROUND_AV_UNK_5
Definition WorldStateDefines.h:161
@ WORLD_STATE_OPVP_ZM_UNK
Definition WorldStateDefines.h:437
@ WORLD_STATE_BATTLEGROUND_AV_AID_A_C
Definition WorldStateDefines.h:96
@ WORLD_STATE_AHNQIRAJ_SANDWORM_SW
Definition WorldStateDefines.h:511
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_NEU_H
Definition WorldStateDefines.h:500
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_DISPLAY_W
Definition WorldStateDefines.h:416
@ WORLD_STATE_BATTLEGROUND_WS_FLAG_STATE_ALLIANCE
Definition WorldStateDefines.h:176
@ WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_UNUSED
Definition WorldStateDefines.h:159
@ WORLD_STATE_BATTLEGROUND_AV_DUNS_DESTROYED
Definition WorldStateDefines.h:135
@ WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_A_C
Definition WorldStateDefines.h:104
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_POS_W
Definition WorldStateDefines.h:417
@ WORLD_STATE_OPVP_NA_UI_GUARDS_MAX
Definition WorldStateDefines.h:475
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_ASSAULTED
Definition WorldStateDefines.h:155
@ WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_POS
Definition WorldStateDefines.h:453
@ WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_A
Definition WorldStateDefines.h:449
@ WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_H_A
Definition WorldStateDefines.h:115
@ WORLD_STATE_OPVP_TF_TOWER_NUM_07
Definition WorldStateDefines.h:462
@ WORLD_STATE_BATTLEGROUND_AV_ICEWING_UNUSED
Definition WorldStateDefines.h:141
@ WORLD_STATE_BATTLEGROUND_AV_STONEH_UNUSED
Definition WorldStateDefines.h:142
@ WORLD_STATE_VIOLET_HOLD_WAVE_COUNT
Definition WorldStateDefines.h:570
@ WORLD_STATE_BATTLEGROUND_IC_ALLIANCE_REINFORCEMENT_SET
Definition WorldStateDefines.h:249
@ WORLD_STATE_ARENA_SEASON_PROGRESS
Definition WorldStateDefines.h:43
@ WORLD_STATE_OPVP_NA_MAP_HALAA_NEUTRAL
Definition WorldStateDefines.h:493
@ WORLD_STATE_BATTLEGROUND_AB_STABLE_ICON
Definition WorldStateDefines.h:206
@ WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_ALLIANCE
Definition WorldStateDefines.h:185
@ WORLD_STATE_BATTLEGROUND_SA_BONUS_TIMER
Definition WorldStateDefines.h:309
@ WORLD_STATE_OPVP_TF_TOWER_NUM_14
Definition WorldStateDefines.h:469
@ WORLD_STATE_BATTLEGROUND_AV_N_MINE_H
Definition WorldStateDefines.h:124
@ WORLD_STATE_BATTLEGROUND_RV_ARENA_GOLD
Definition WorldStateDefines.h:353
@ WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_POS
Definition WorldStateDefines.h:402
@ WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_H_C
Definition WorldStateDefines.h:105
@ WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N
Definition WorldStateDefines.h:368
@ WORLD_STATE_OPVP_HP_STADIUM_A
Definition WorldStateDefines.h:399
@ WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_DESTROYED
Definition WorldStateDefines.h:132
@ WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_A
Definition WorldStateDefines.h:382
@ WORLD_STATE_OPVP_HP_BROKENHILL_H
Definition WorldStateDefines.h:410
@ WORLD_STATE_BATTLEGROUND_BE_ARENA_GREEN
Definition WorldStateDefines.h:333
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_NEU_H
Definition WorldStateDefines.h:501
@ WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_STATUS
Definition WorldStateDefines.h:216
@ WORLD_STATE_OPVP_NA_MAP_HALAA_HORDE
Definition WorldStateDefines.h:494
@ WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_TWILIGHT
Definition WorldStateDefines.h:544
@ WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_ICON
Definition WorldStateDefines.h:210
@ WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_N
Definition WorldStateDefines.h:386
@ WORLD_STATE_HALLS_OF_REFLECTION_WAVE_COUNT
Definition WorldStateDefines.h:575
@ WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_H
Definition WorldStateDefines.h:497
@ WORLD_STATE_BATTLEGROUND_AV_S_MINE_A
Definition WorldStateDefines.h:120
@ WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_N
Definition WorldStateDefines.h:162
@ WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_ALLIANCE_CONFLICT
Definition WorldStateDefines.h:234
@ WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_ALLIANCE
Definition WorldStateDefines.h:181
@ WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_HORDE
Definition WorldStateDefines.h:173
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_H_C
Definition WorldStateDefines.h:117
@ WORLD_STATE_OCULUS_CENTRIFUGE_CONSTRUCT_SHOW
Definition WorldStateDefines.h:563
@ WORLD_STATE_BATTLEGROUND_SA_ALLIANCE_DEFENSE_TOKEN
Definition WorldStateDefines.h:318
@ WORLD_STATE_OPVP_EP_UNK_2
Definition WorldStateDefines.h:389
@ WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_HORDE
Definition WorldStateDefines.h:195
@ WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_A
Definition WorldStateDefines.h:422
@ WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_H
Definition WorldStateDefines.h:405
@ WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_A
Definition WorldStateDefines.h:428
@ WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_H
Definition WorldStateDefines.h:450
@ WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_N_W
Definition WorldStateDefines.h:418
@ WORLD_STATE_BATTLEGROUND_AB_OCCUPIED_BASES_HORDE
Definition WorldStateDefines.h:191
@ WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_CONTROLLED_ALLIANCE
Definition WorldStateDefines.h:204
@ WORLD_STATE_ARENA_SEASON_ID
Definition WorldStateDefines.h:46
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_ENABLE
Definition WorldStateDefines.h:518
@ WORLD_STATE_BATTLEGROUND_SA_HORDE_DEFENSE_TOKEN
Definition WorldStateDefines.h:319
@ WORLD_STATE_OPVP_TF_TOWER_NUM_15
Definition WorldStateDefines.h:460
@ WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_ALLIANCE_CONTROL
Definition WorldStateDefines.h:226
@ WORLD_STATE_BATTLEGROUND_BE_ARENA_SHOW
Definition WorldStateDefines.h:334
@ WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_MAX
Definition WorldStateDefines.h:174
@ WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_MATERIAL
Definition WorldStateDefines.h:543
@ WORLD_STATE_OPVP_HP_OVERLOOK_A
Definition WorldStateDefines.h:406
@ WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_A_C
Definition WorldStateDefines.h:116
@ WORLD_STATE_BATTLEGROUND_RL_ARENA_GOLD
Definition WorldStateDefines.h:342
@ WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_H
Definition WorldStateDefines.h:423
@ WORLD_STATE_BATTLEGROUND_EY_HORDE_RESOURCES
Definition WorldStateDefines.h:241
@ WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_H
Definition WorldStateDefines.h:433
@ WORLD_STATE_BATTLEGROUND_IC_UNK
Definition WorldStateDefines.h:256
@ WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_HORDE_CONTROL
Definition WorldStateDefines.h:225
@ WORLD_STATE_BATTLEGROUND_IC_GATE_WEST_A_WS_OPEN
Definition WorldStateDefines.h:286
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_A
Definition WorldStateDefines.h:483
@ WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SCOURGE_COUNT
Definition WorldStateDefines.h:516
@ WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_UNCONTROL
Definition WorldStateDefines.h:218
@ WORLD_STATE_OPVP_EP_NORTHPASSTOWER_A
Definition WorldStateDefines.h:378
@ WORLD_STATE_BATTLEGROUND_IC_QUARRY_UNCONTROLLED
Definition WorldStateDefines.h:269
@ WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_A
Definition WorldStateDefines.h:432
@ WORLD_STATE_SCOURGE_INVASION_AZSHARA
Definition WorldStateDefines.h:28
@ WORLD_STATE_BATTLEGROUND_EY_FLAG_STATE_ALLIANCE
Definition WorldStateDefines.h:245
@ WORLD_STATE_BATTLEGROUND_DS_ARENA_GOLD
Definition WorldStateDefines.h:348
@ WORLD_STATE_VIOLET_HOLD_PRISON_STATE
Definition WorldStateDefines.h:571
@ WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_NEUTRAL
Definition WorldStateDefines.h:444
@ WORLD_STATE_OPVP_SI_GATHERED_A
Definition WorldStateDefines.h:357
@ WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_PERCENT_GREY
Definition WorldStateDefines.h:217
@ WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_HORDE_CONTROL
Definition WorldStateDefines.h:223
@ WORLD_STATE_OPVP_EP_EASTWALLTOWER_A
Definition WorldStateDefines.h:367
@ WORLD_STATE_ICECROWN_CITADEL_SHOW_TIMER
Definition WorldStateDefines.h:548
@ WORLD_STATE_OPVP_EP_NORTHPASSTOWER_H
Definition WorldStateDefines.h:379
@ WORLD_STATE_BATTLEGROUND_IC_DOCKS_UNCONTROLLED
Definition WorldStateDefines.h:264
@ WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_CONTROLLED_ALLIANCE
Definition WorldStateDefines.h:200
@ WORLD_STATE_BATTLEGROUND_NA_ARENA_GOLD
Definition WorldStateDefines.h:337
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_A
Definition WorldStateDefines.h:488
@ WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW
Definition WorldStateDefines.h:559
@ WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_ALLIANCE
Definition WorldStateDefines.h:194
@ WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_H
Definition WorldStateDefines.h:371
@ WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_H
Definition WorldStateDefines.h:490
@ WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_A_A
Definition WorldStateDefines.h:106
@ WORLD_STATE_BATTLEGROUND_DS_ARENA_GREEN
Definition WorldStateDefines.h:347
@ WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_H
Definition WorldStateDefines.h:363
@ WORLD_STATE_BATTLEGROUND_AB_UNK
Definition WorldStateDefines.h:211
@ WORLD_STATE_OPVP_NA_UI_ALLIANCE_GUARDS_SHOW
Definition WorldStateDefines.h:479
@ WORLD_STATE_OPVP_TF_TOWER_NUM_02
Definition WorldStateDefines.h:456
@ WORLD_STATE_BATTLEGROUND_SA_ANCIENT_GATE
Definition WorldStateDefines.h:327
@ WORLD_STATE_OPVP_EP_UNK_7
Definition WorldStateDefines.h:394
@ WORLD_STATE_BATTLEGROUND_AV_UNK_3
Definition WorldStateDefines.h:151
@ WORLD_STATE_BATTLEGROUND_IC_HORDE_REINFORCEMENT_SET
Definition WorldStateDefines.h:250
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &)=0
uint32 GetTypeId()
Definition Battlefield.h:241
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &)
Definition Battleground.h:451
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition Battleground.h:320
Definition CreatureAI.h:70
Definition InstanceScript.h:143
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &)
Definition InstanceScript.h:264
Definition OutdoorPvP.h:186
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &)
Definition OutdoorPvP.h:203
uint32 GetTypeId() const
Definition OutdoorPvP.h:238
void SendBGWeekendWorldStates()
Definition Player.cpp:8861
void SendBattlefieldWorldStates()
Definition Player.cpp:8876
static std::unordered_map< int, bgZoneRef > bgZoneIdToFillWorldStates
Definition Player.h:16115
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1160
Definition WorldStatePackets.h:28
std::vector< WorldStateInfo > Worldstates
Definition WorldStatePackets.h:46
int32 MapID
Definition WorldStatePackets.h:42
int32 AreaID
Definition WorldStatePackets.h:44
WorldPacket const * Write() override
Definition WorldStatePackets.cpp:22
int32 ZoneID
Definition WorldStatePackets.h:43

References AREA_ALTERAC_VALLEY, AREA_ARATHI_BASIN, AREA_BLADES_EDGE_ARENA, AREA_DALARAN_ARENA, AREA_DEEPRUN_TRAM, AREA_DUN_MOROGH, AREA_EASTERN_PLAGUELANDS, AREA_ELWYNN_FOREST, AREA_EYE_OF_THE_STORM, AREA_HALLS_OF_REFLECTION, AREA_HELLFIRE_PENINSULA, AREA_ICECROWN_CITADEL, AREA_IRONFORGE, AREA_ISLE_OF_CONQUEST, AREA_LOCH_MODAN, AREA_NAGRAND, AREA_NAGRAND_ARENA, AREA_PLAGUELANDS_THE_SCARLET_ENCLAVE, AREA_RUINS_OF_LORDAERON, AREA_SEARING_GORGE, AREA_SHATTRATH_CITY, AREA_SILITHUS, AREA_STORMWIND_CITY, AREA_STRAND_OF_THE_ANCIENTS, AREA_TEROKKAR_FOREST, AREA_THE_CULLING_OF_STRATHOLME, AREA_THE_OCULUS, AREA_THE_RUBY_SANCTUM, AREA_THE_VIOLET_HOLD, AREA_ULDUAR, AREA_WARSONG_GULCH, AREA_WESTFALL, AREA_WETLANDS, AREA_WINTERGRASP, AREA_ZANGARMARSH, WorldPackets::WorldState::InitWorldStates::AreaID, ARENA_SEASON_STATE_IN_PROGRESS, ARENA_THE_RING_OF_VALOR, BATTLEFIELD_WG, BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_EY, BATTLEGROUND_IC, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_RV, BATTLEGROUND_SA, BATTLEGROUND_WS, bgZoneIdToFillWorldStates, Battleground::FillInitialWorldStates(), InstanceScript::FillInitialWorldStates(), OutdoorPvP::FillInitialWorldStates(), Battlefield::FillInitialWorldStates(), GetBattleground(), Battleground::GetBgTypeID(), ObjectAccessor::GetCreature(), WorldObject::GetInstanceScript(), WorldLocation::GetMapId(), Battlefield::GetTypeId(), OutdoorPvP::GetTypeId(), LOG_DEBUG, MAP_HALLS_OF_REFLECTION, MAP_ICECROWN_CITADEL, MAP_OUTLAND, MAP_THE_CULLING_OF_STRATHOLME, MAP_THE_OCULUS, MAP_ULDUAR, WorldPackets::WorldState::InitWorldStates::MapID, OUTDOOR_PVP_EP, OUTDOOR_PVP_HP, OUTDOOR_PVP_NA, OUTDOOR_PVP_SI, OUTDOOR_PVP_TF, OUTDOOR_PVP_ZM, sArenaSeasonMgr, sBattlefieldMgr, SendBattlefieldWorldStates(), SendBGWeekendWorldStates(), SendDirectMessage(), sOutdoorPvPMgr, sWorldState, WORLD_STATE_AHNQIRAJ_SANDWORM_E, WORLD_STATE_AHNQIRAJ_SANDWORM_N, WORLD_STATE_AHNQIRAJ_SANDWORM_S, WORLD_STATE_AHNQIRAJ_SANDWORM_SW, WORLD_STATE_ARENA_SEASON_ID, WORLD_STATE_ARENA_SEASON_PROGRESS, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_ENABLE, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_COUNTDOWN_TIME, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_DEFENDERS_COUNT, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_EVENT_BEGIN_ENABLE, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SCOURGE_COUNT, WORLD_STATE_BATTLE_FOR_LIGHTS_HOPE_SOLDIERS_ENABLE, WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_ICON, WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_CONTROLLED_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_CONTROLLED_HORDE, WORLD_STATE_BATTLEGROUND_AB_BLACKSMITH_STATE_HORDE, WORLD_STATE_BATTLEGROUND_AB_FARM_ICON, WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_CONTROLLED_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_CONTROLLED_HORDE, WORLD_STATE_BATTLEGROUND_AB_FARM_STATE_HORDE, WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_ICON, WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_CONTROLLED_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_CONTROLLED_HORDE, WORLD_STATE_BATTLEGROUND_AB_GOLDMINE_STATE_HORDE, WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_ICON, WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_CONTROLLED_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_CONTROLLED_HORDE, WORLD_STATE_BATTLEGROUND_AB_LUMBERMILL_STATE_HORDE, WORLD_STATE_BATTLEGROUND_AB_OCCUPIED_BASES_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_OCCUPIED_BASES_HORDE, WORLD_STATE_BATTLEGROUND_AB_RESOURCES_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_RESOURCES_HORDE, WORLD_STATE_BATTLEGROUND_AB_RESOURCES_MAX, WORLD_STATE_BATTLEGROUND_AB_RESOURCES_WARNING, WORLD_STATE_BATTLEGROUND_AB_STABLE_ICON, WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_CONTROLLED_ALLIANCE, WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_CONTROLLED_HORDE, WORLD_STATE_BATTLEGROUND_AB_STABLE_STATE_HORDE, WORLD_STATE_BATTLEGROUND_AB_UNK, WORLD_STATE_BATTLEGROUND_AV_AID_A_A, WORLD_STATE_BATTLEGROUND_AV_AID_A_C, WORLD_STATE_BATTLEGROUND_AV_AID_H_A, WORLD_STATE_BATTLEGROUND_AV_AID_H_C, WORLD_STATE_BATTLEGROUND_AV_DUNN_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_DUNN_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_DUNN_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_DUNN_UNUSED, WORLD_STATE_BATTLEGROUND_AV_DUNS_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_DUNS_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_DUNS_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_DUNS_UNUSED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_A_A, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_A_C, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_H_A, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLF_H_C, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFE_UNUSED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_A_A, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_A_C, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_H_A, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFHUT_H_C, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_FROSTWOLFW_UNUSED, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_A_A, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_A_C, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_H_A, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_H_C, WORLD_STATE_BATTLEGROUND_AV_ICEBLOOD_UNUSED, WORLD_STATE_BATTLEGROUND_AV_ICEWING_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_ICEWING_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_ICEWING_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_ICEWING_UNUSED, WORLD_STATE_BATTLEGROUND_AV_N_MINE_A, WORLD_STATE_BATTLEGROUND_AV_N_MINE_H, WORLD_STATE_BATTLEGROUND_AV_N_MINE_N, WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_A_A, WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_A_C, WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_H_A, WORLD_STATE_BATTLEGROUND_AV_PIKEGRAVE_H_C, WORLD_STATE_BATTLEGROUND_AV_S_MINE_A, WORLD_STATE_BATTLEGROUND_AV_S_MINE_H, WORLD_STATE_BATTLEGROUND_AV_S_MINE_N, WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_A_A, WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_A_C, WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_H_A, WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_H_C, WORLD_STATE_BATTLEGROUND_AV_SNOWFALL_N, WORLD_STATE_BATTLEGROUND_AV_STONEH_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_STONEH_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_STONEH_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_STONEH_UNUSED, WORLD_STATE_BATTLEGROUND_AV_STONEHEART_A_A, WORLD_STATE_BATTLEGROUND_AV_STONEHEART_A_C, WORLD_STATE_BATTLEGROUND_AV_STONEHEART_H_A, WORLD_STATE_BATTLEGROUND_AV_STONEHEART_H_C, WORLD_STATE_BATTLEGROUND_AV_STORMPIKE_COMMANDERS, WORLD_STATE_BATTLEGROUND_AV_STORMPIKE_LIEUTENANTS, WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_ASSAULTED, WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_CONTROLLED, WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_DESTROYED, WORLD_STATE_BATTLEGROUND_AV_TOWERPOINT_UNUSED, WORLD_STATE_BATTLEGROUND_AV_UNK_0, WORLD_STATE_BATTLEGROUND_AV_UNK_1, WORLD_STATE_BATTLEGROUND_AV_UNK_2, WORLD_STATE_BATTLEGROUND_AV_UNK_3, WORLD_STATE_BATTLEGROUND_AV_UNK_4, WORLD_STATE_BATTLEGROUND_AV_UNK_5, WORLD_STATE_BATTLEGROUND_BE_ARENA_GOLD, WORLD_STATE_BATTLEGROUND_BE_ARENA_GREEN, WORLD_STATE_BATTLEGROUND_BE_ARENA_SHOW, WORLD_STATE_BATTLEGROUND_DS_ARENA_GOLD, WORLD_STATE_BATTLEGROUND_DS_ARENA_GREEN, WORLD_STATE_BATTLEGROUND_DS_ARENA_SHOW, WORLD_STATE_BATTLEGROUND_EY_ALLIANCE_BASE, WORLD_STATE_BATTLEGROUND_EY_ALLIANCE_RESOURCES, WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_ALLIANCE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_HORDE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_BLOOD_ELF_UNCONTROL, WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_ALLIANCE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_ALLIANCE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_HORDE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_HORDE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_DRAENEI_RUINS_UNCONTROL, WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_ALLIANCE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_ALLIANCE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_HORDE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_HORDE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_FEL_REAVER_UNCONTROL, WORLD_STATE_BATTLEGROUND_EY_FLAG, WORLD_STATE_BATTLEGROUND_EY_FLAG_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_EY_FLAG_STATE_HORDE, WORLD_STATE_BATTLEGROUND_EY_HORDE_BASE, WORLD_STATE_BATTLEGROUND_EY_HORDE_RESOURCES, WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_ALLIANCE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_ALLIANCE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_HORDE_CONFLICT, WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_HORDE_CONTROL, WORLD_STATE_BATTLEGROUND_EY_MAGE_TOWER_UNCONTROL, WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_PERCENT_GREY, WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_SHOW, WORLD_STATE_BATTLEGROUND_EY_PROGRESS_BAR_STATUS, WORLD_STATE_BATTLEGROUND_EY_UNK_0, WORLD_STATE_BATTLEGROUND_EY_UNK_1, WORLD_STATE_BATTLEGROUND_EY_UNK_2, WORLD_STATE_BATTLEGROUND_EY_UNK_3, WORLD_STATE_BATTLEGROUND_IC_ALLIANCE_REINFORCEMENT, WORLD_STATE_BATTLEGROUND_IC_ALLIANCE_REINFORCEMENT_SET, WORLD_STATE_BATTLEGROUND_IC_DOCKS_UNCONTROLLED, WORLD_STATE_BATTLEGROUND_IC_GATE_EAST_A_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_GATE_EAST_H_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_A_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_H_WS_CLOSED, WORLD_STATE_BATTLEGROUND_IC_GATE_FRONT_H_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_GATE_WEST_A_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_GATE_WEST_H_WS_OPEN, WORLD_STATE_BATTLEGROUND_IC_HANGAR_UNCONTROLLED, WORLD_STATE_BATTLEGROUND_IC_HORDE_KEEP_CONTROLLED_H, WORLD_STATE_BATTLEGROUND_IC_HORDE_REINFORCEMENT, WORLD_STATE_BATTLEGROUND_IC_HORDE_REINFORCEMENT_SET, WORLD_STATE_BATTLEGROUND_IC_QUARRY_UNCONTROLLED, WORLD_STATE_BATTLEGROUND_IC_REFINERY_UNCONTROLLED, WORLD_STATE_BATTLEGROUND_IC_UNK, WORLD_STATE_BATTLEGROUND_IC_WORKSHOP_UNCONTROLLED, WORLD_STATE_BATTLEGROUND_NA_ARENA_GOLD, WORLD_STATE_BATTLEGROUND_NA_ARENA_GREEN, WORLD_STATE_BATTLEGROUND_NA_ARENA_SHOW, WORLD_STATE_BATTLEGROUND_RL_ARENA_GOLD, WORLD_STATE_BATTLEGROUND_RL_ARENA_GREEN, WORLD_STATE_BATTLEGROUND_RL_ARENA_SHOW, WORLD_STATE_BATTLEGROUND_RV_ARENA_GOLD, WORLD_STATE_BATTLEGROUND_RV_ARENA_GREEN, WORLD_STATE_BATTLEGROUND_RV_ARENA_SHOW, WORLD_STATE_BATTLEGROUND_SA_ALLIANCE_DEFENSE_TOKEN, WORLD_STATE_BATTLEGROUND_SA_ANCIENT_GATE, WORLD_STATE_BATTLEGROUND_SA_BLUE_GATE, WORLD_STATE_BATTLEGROUND_SA_BONUS_TIMER, WORLD_STATE_BATTLEGROUND_SA_CENTER_GY_ALLIANCE, WORLD_STATE_BATTLEGROUND_SA_CENTER_GY_HORDE, WORLD_STATE_BATTLEGROUND_SA_ENABLE_TIMER, WORLD_STATE_BATTLEGROUND_SA_GREEN_GATE, WORLD_STATE_BATTLEGROUND_SA_HORDE_ATTACKER, WORLD_STATE_BATTLEGROUND_SA_HORDE_DEFENSE_TOKEN, WORLD_STATE_BATTLEGROUND_SA_LEFT_ATTACK_TOKEN_ALLIANCE, WORLD_STATE_BATTLEGROUND_SA_LEFT_ATTACK_TOKEN_HORDE, WORLD_STATE_BATTLEGROUND_SA_LEFT_GY_ALLIANCE, WORLD_STATE_BATTLEGROUND_SA_LEFT_GY_HORDE, WORLD_STATE_BATTLEGROUND_SA_PURPLE_GATE, WORLD_STATE_BATTLEGROUND_SA_RED_GATE, WORLD_STATE_BATTLEGROUND_SA_RIGHT_ATTACK_TOKEN_ALLIANCE, WORLD_STATE_BATTLEGROUND_SA_RIGHT_ATTACK_TOKEN_HORDE, WORLD_STATE_BATTLEGROUND_SA_RIGHT_GY_ALLIANCE, WORLD_STATE_BATTLEGROUND_SA_RIGHT_GY_HORDE, WORLD_STATE_BATTLEGROUND_SA_TIMER_MINUTES, WORLD_STATE_BATTLEGROUND_SA_TIMER_SECONDS_FIRST_DIGIT, WORLD_STATE_BATTLEGROUND_SA_TIMER_SECONDS_SECOND_DIGIT, WORLD_STATE_BATTLEGROUND_SA_YELLOW_GATE, WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_ALLIANCE, WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_HORDE, WORLD_STATE_BATTLEGROUND_WS_FLAG_CAPTURES_MAX, WORLD_STATE_BATTLEGROUND_WS_FLAG_STATE_ALLIANCE, WORLD_STATE_BATTLEGROUND_WS_FLAG_STATE_HORDE, WORLD_STATE_BATTLEGROUND_WS_UNK_0, WORLD_STATE_BATTLEGROUND_WS_UNK_1, WORLD_STATE_BATTLEGROUND_WS_UNK_2, WORLD_STATE_CULLING_OF_STRATHOLME_CRATES_REVEALED, WORLD_STATE_CULLING_OF_STRATHOLME_SHOW_CRATES, WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN, WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW, WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, WORLD_STATE_HALLS_OF_REFLECTION_WAVE_COUNT, WORLD_STATE_HALLS_OF_REFLECTION_WAVES_ENABLED, WORLD_STATE_ICECROWN_CITADEL_ATTEMPTS_MAX, WORLD_STATE_ICECROWN_CITADEL_ATTEMPTS_REMAINING, WORLD_STATE_ICECROWN_CITADEL_EXECUTION_TIME, WORLD_STATE_ICECROWN_CITADEL_SHOW_ATTEMPTS, WORLD_STATE_ICECROWN_CITADEL_SHOW_TIMER, WORLD_STATE_OCULUS_CENTRIFUGE_CONSTRUCT_AMOUNT, WORLD_STATE_OCULUS_CENTRIFUGE_CONSTRUCT_SHOW, WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_A, WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_H, WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N, WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N_A, WORLD_STATE_OPVP_EP_CROWNGUARDTOWER_N_H, WORLD_STATE_OPVP_EP_EASTWALLTOWER_A, WORLD_STATE_OPVP_EP_EASTWALLTOWER_H, WORLD_STATE_OPVP_EP_EASTWALLTOWER_N, WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_A, WORLD_STATE_OPVP_EP_EASTWALLTOWER_N_H, WORLD_STATE_OPVP_EP_NORTHPASSTOWER_A, WORLD_STATE_OPVP_EP_NORTHPASSTOWER_H, WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N, WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N_A, WORLD_STATE_OPVP_EP_NORTHPASSTOWER_N_H, WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_A, WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_H, WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_N, WORLD_STATE_OPVP_EP_PLAGUEWOODTOWER_N_A, WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_A, WORLD_STATE_OPVP_EP_UI_TOWER_COUNT_H, WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_DISPLAY, WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_N, WORLD_STATE_OPVP_EP_UI_TOWER_SLIDER_POS, WORLD_STATE_OPVP_EP_UNK_0, WORLD_STATE_OPVP_EP_UNK_1, WORLD_STATE_OPVP_EP_UNK_2, WORLD_STATE_OPVP_EP_UNK_3, WORLD_STATE_OPVP_EP_UNK_5, WORLD_STATE_OPVP_EP_UNK_6, WORLD_STATE_OPVP_EP_UNK_7, WORLD_STATE_OPVP_EP_UNK_8, WORLD_STATE_OPVP_HP_BROKENHILL_A, WORLD_STATE_OPVP_HP_BROKENHILL_H, WORLD_STATE_OPVP_HP_BROKENHILL_N, WORLD_STATE_OPVP_HP_OVERLOOK_A, WORLD_STATE_OPVP_HP_OVERLOOK_H, WORLD_STATE_OPVP_HP_OVERLOOK_N, WORLD_STATE_OPVP_HP_STADIUM_A, WORLD_STATE_OPVP_HP_STADIUM_H, WORLD_STATE_OPVP_HP_STADIUM_N, WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_A, WORLD_STATE_OPVP_HP_UI_TOWER_COUNT_H, WORLD_STATE_OPVP_HP_UI_TOWER_DISPLAY_A, WORLD_STATE_OPVP_HP_UI_TOWER_DISPLAY_H, WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_DISPLAY, WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_N, WORLD_STATE_OPVP_HP_UI_TOWER_SLIDER_POS, WORLD_STATE_OPVP_NA_MAP_HALAA_ALLIANCE, WORLD_STATE_OPVP_NA_MAP_HALAA_HORDE, WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_A, WORLD_STATE_OPVP_NA_MAP_HALAA_NEU_H, WORLD_STATE_OPVP_NA_MAP_HALAA_NEUTRAL, WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_NEU_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_EAST_NEU_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_NEU_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_NORTH_NEU_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_NEU_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_SOUTH_NEU_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_H, WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_NEU_A, WORLD_STATE_OPVP_NA_MAP_WYVERN_WEST_NEU_H, WORLD_STATE_OPVP_NA_UI_ALLIANCE_GUARDS_SHOW, WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT, WORLD_STATE_OPVP_NA_UI_GUARDS_MAX, WORLD_STATE_OPVP_NA_UI_HORDE_GUARDS_SHOW, WORLD_STATE_OPVP_NA_UI_SLIDER_N, WORLD_STATE_OPVP_NA_UI_TOWER_SLIDER_DISPLAY, WORLD_STATE_OPVP_NA_UI_TOWER_SLIDER_POS, WORLD_STATE_OPVP_SI_GATHERED_A, WORLD_STATE_OPVP_SI_GATHERED_H, WORLD_STATE_OPVP_SI_SILITHYST_MAX, WORLD_STATE_OPVP_TF_TOWER_NUM_00, WORLD_STATE_OPVP_TF_TOWER_NUM_01, WORLD_STATE_OPVP_TF_TOWER_NUM_02, WORLD_STATE_OPVP_TF_TOWER_NUM_03, WORLD_STATE_OPVP_TF_TOWER_NUM_04, WORLD_STATE_OPVP_TF_TOWER_NUM_05, WORLD_STATE_OPVP_TF_TOWER_NUM_06, WORLD_STATE_OPVP_TF_TOWER_NUM_07, WORLD_STATE_OPVP_TF_TOWER_NUM_08, WORLD_STATE_OPVP_TF_TOWER_NUM_09, WORLD_STATE_OPVP_TF_TOWER_NUM_10, WORLD_STATE_OPVP_TF_TOWER_NUM_11, WORLD_STATE_OPVP_TF_TOWER_NUM_12, WORLD_STATE_OPVP_TF_TOWER_NUM_13, WORLD_STATE_OPVP_TF_TOWER_NUM_14, WORLD_STATE_OPVP_TF_TOWER_NUM_15, WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_ALLIANCE, WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_HORDE, WORLD_STATE_OPVP_TF_UI_LOCKED_DISPLAY_NEUTRAL, WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_HOURS, WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT, WORLD_STATE_OPVP_TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT, WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_A, WORLD_STATE_OPVP_TF_UI_TOWER_COUNT_H, WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_DISPLAY, WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_N, WORLD_STATE_OPVP_TF_UI_TOWER_SLIDER_POS, WORLD_STATE_OPVP_TF_UI_TOWERS_CONTROLLED_DISPLAY, WORLD_STATE_OPVP_ZM_MAP_ALLIANCE_FLAG_NOT_READY, WORLD_STATE_OPVP_ZM_MAP_ALLIANCE_FLAG_READY, WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_A, WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_H, WORLD_STATE_OPVP_ZM_MAP_GRAVEYARD_N, WORLD_STATE_OPVP_ZM_MAP_HORDE_FLAG_NOT_READY, WORLD_STATE_OPVP_ZM_MAP_HORDE_FLAG_READY, WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_A, WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_H, WORLD_STATE_OPVP_ZM_MAP_TOWER_EAST_N, WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_A, WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_H, WORLD_STATE_OPVP_ZM_MAP_TOWER_WEST_N, WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_A, WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_H, WORLD_STATE_OPVP_ZM_UI_TOWER_EAST_N, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_DISPLAY_E, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_DISPLAY_W, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_N_E, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_N_W, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_POS_E, WORLD_STATE_OPVP_ZM_UI_TOWER_SLIDER_POS_W, WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_A, WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_H, WORLD_STATE_OPVP_ZM_UI_TOWER_WEST_N, WORLD_STATE_OPVP_ZM_UNK, WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_MATERIAL, WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_TOGGLE, WORLD_STATE_RUBY_SANCTUM_CORPOREALITY_TWILIGHT, WORLD_STATE_SCOURGE_INVASION_AZSHARA, WORLD_STATE_SCOURGE_INVASION_BLASTED_LANDS, WORLD_STATE_SCOURGE_INVASION_BURNING_STEPPES, WORLD_STATE_SCOURGE_INVASION_EASTERN_PLAGUELANDS, WORLD_STATE_SCOURGE_INVASION_TANARIS, WORLD_STATE_SCOURGE_INVASION_WINTERSPRING, WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER, WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED, WORLD_STATE_VIOLET_HOLD_PRISON_STATE, WORLD_STATE_VIOLET_HOLD_SHOW, WORLD_STATE_VIOLET_HOLD_WAVE_COUNT, WorldPackets::WorldState::InitWorldStates::Worldstates, WorldPackets::WorldState::InitWorldStates::Write(), and WorldPackets::WorldState::InitWorldStates::ZoneID.

Referenced by ArenaSeasonMgr::BroadcastUpdatedWorldState(), WorldSession::HandlePlayerLoginToCharInWorld(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerAreaUpdate(), and UpdateZone().

◆ SendInstanceResetWarning()

void Player::SendInstanceResetWarning ( uint32  mapid,
Difficulty  difficulty,
uint32  time,
bool  onEnterMap 
)
11706{
11707 // pussywizard:
11708 InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(GetGUID(), mapid, difficulty);
11709 if (bind && bind->extended)
11710 {
11711 if (!onEnterMap) // extended id player shouldn't be warned about lock expiration
11712 return;
11713 time += (bind->save->GetExtendedResetTime() - bind->save->GetResetTime()); // add lockout period to the time left
11714 }
11715
11716 // type of warning, based on the time remaining until reset
11717 uint32 type;
11718 if (time > 3600)
11719 type = RAID_INSTANCE_WELCOME;
11720 else if (time > 900)
11722 else if (time > 300)
11724 else
11726
11727 WorldPacket data(SMSG_RAID_INSTANCE_MESSAGE, 4 + 4 + 4 + 4);
11728 data << uint32(type);
11729 data << uint32(mapid);
11730 data << uint32(difficulty); // difficulty
11731 data << uint32(time);
11732 if (type == RAID_INSTANCE_WELCOME)
11733 {
11734 data << uint8(bind && bind->perm); // is locked
11735 data << uint8(bind && bind->extended); // is extended, ignored if prev field is 0
11736 }
11737 GetSession()->SendPacket(&data);
11738}
@ RAID_INSTANCE_WARNING_MIN
Definition Player.h:811
@ RAID_INSTANCE_WARNING_MIN_SOON
Definition Player.h:812
@ RAID_INSTANCE_WARNING_HOURS
Definition Player.h:810
@ RAID_INSTANCE_WELCOME
Definition Player.h:813
time_t GetExtendedResetTime() const
Definition InstanceSaveMgr.h:76
time_t GetResetTime() const
Definition InstanceSaveMgr.h:75
@ SMSG_RAID_INSTANCE_MESSAGE
Definition Opcodes.h:792
Definition InstanceSaveMgr.h:39
InstanceSave * save
Definition InstanceSaveMgr.h:40
bool extended
Definition InstanceSaveMgr.h:42
bool perm
Definition InstanceSaveMgr.h:41

References InstancePlayerBind::extended, InstanceSave::GetExtendedResetTime(), Object::GetGUID(), InstanceSave::GetResetTime(), GetSession(), InstancePlayerBind::perm, RAID_INSTANCE_WARNING_HOURS, RAID_INSTANCE_WARNING_MIN, RAID_INSTANCE_WARNING_MIN_SOON, RAID_INSTANCE_WELCOME, InstancePlayerBind::save, WorldSession::SendPacket(), sInstanceSaveMgr, and SMSG_RAID_INSTANCE_MESSAGE.

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendItemDurations()

void Player::SendItemDurations ( )
4750{
4751 for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
4752 {
4753 (*itr)->SendTimeUpdate(this);
4754 }
4755}

References m_itemDuration.

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendItemRetrievalMail() [1/2]

void Player::SendItemRetrievalMail ( std::vector< std::pair< uint32, uint32 > >  mailItems)
445{
446 if (mailItems.empty())
447 {
448 // Skip send if empty items
449 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Attempt to send almost with items without items. Player {}", GetGUID().ToString());
450 return;
451 }
452
453 using SendMailTempateVector = std::vector<std::pair<uint32, uint32>>;
454
455 std::vector<SendMailTempateVector> allItems;
456
457 auto AddMailItem = [&allItems](uint32 itemEntry, uint32 itemCount)
458 {
459 SendMailTempateVector toSendItems;
460
461 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemEntry);
462 if (!itemTemplate)
463 {
464 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Item id {} is invalid", itemEntry);
465 return;
466 }
467
468 if (itemCount < 1 || (itemTemplate->MaxCount > 0 && itemCount > static_cast<uint32>(itemTemplate->MaxCount)))
469 {
470 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Incorrect item count ({}) for item id {}", itemEntry, itemCount);
471 return;
472 }
473
474 while (itemCount > itemTemplate->GetMaxStackSize())
475 {
476 if (toSendItems.size() <= MAX_MAIL_ITEMS)
477 {
478 toSendItems.emplace_back(itemEntry, itemTemplate->GetMaxStackSize());
479 itemCount -= itemTemplate->GetMaxStackSize();
480 }
481 else
482 {
483 allItems.emplace_back(toSendItems);
484 toSendItems.clear();
485 }
486 }
487
488 toSendItems.emplace_back(itemEntry, itemCount);
489 allItems.emplace_back(toSendItems);
490 };
491
492 for (auto& [itemEntry, itemCount] : mailItems)
493 {
494 AddMailItem(itemEntry, itemCount);
495 }
496
497 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
498
499 for (auto const& items : allItems)
500 {
501 MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */);
502 MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed.
503
504 for (auto const& [itemEntry, itemCount] : items)
505 {
506 if (Item* mailItem = Item::CreateItem(itemEntry, itemCount))
507 {
508 mailItem->SaveToDB(trans);
509 draft.AddItem(mailItem);
510 }
511 }
512
513 draft.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), sender);
514 }
515
516 CharacterDatabase.CommitTransaction(trans);
517}

References MailDraft::AddItem(), CharacterDatabase, Item::CreateItem(), Object::GetGUID(), ItemTemplate::GetMaxStackSize(), LOG_ERROR, MAIL_CREATURE, MAX_MAIL_ITEMS, ItemTemplate::MaxCount, MailDraft::SendMailTo(), sObjectMgr, and Position::ToString().

◆ SendItemRetrievalMail() [2/2]

void Player::SendItemRetrievalMail ( uint32  itemEntry,
uint32  count 
)

◆ SendLearnPacket()

void Player::SendLearnPacket ( uint32  spellId,
bool  learn 
)
3046{
3047 if (learn)
3048 {
3050 data << uint32(spellId);
3051 data << uint16(0);
3052 GetSession()->SendPacket(&data);
3053 }
3054 else
3055 {
3057 data << uint32(spellId);
3058 GetSession()->SendPacket(&data);
3059 }
3060}
@ SMSG_REMOVED_SPELL
Definition Opcodes.h:545
@ SMSG_LEARNED_SPELL
Definition Opcodes.h:329

References GetSession(), WorldSession::SendPacket(), SMSG_LEARNED_SPELL, and SMSG_REMOVED_SPELL.

Referenced by _addSpell(), ActivateSpec(), addTalent(), Spell::EffectApplyGlyph(), WorldSession::HandleRemoveGlyph(), learnSpell(), LearnTalent(), removeSpell(), and resetTalents().

◆ SendLogXPGain()

void Player::SendLogXPGain ( uint32  GivenXP,
Unit victim,
uint32  BonusXP,
bool  recruitAFriend = false,
float  group_rate = 1.0f 
)
2367{
2368 WorldPacket data(SMSG_LOG_XPGAIN, 22); // guess size?
2369 data << (victim ? victim->GetGUID() : ObjectGuid::Empty); // guid
2370 data << uint32(GivenXP + BonusXP); // given experience
2371 data << uint8(victim ? 0 : 1); // 00-kill_xp type, 01-non_kill_xp type
2372
2373 if (victim)
2374 {
2375 data << uint32(GivenXP); // experience without bonus
2376
2377 // should use group_rate here but can't figure out how
2378 data << float(1); // 1 - none 0 - 100% group bonus output
2379 }
2380
2381 data << uint8(recruitAFriend ? 1 : 0); // does the GivenXP include a RaF bonus?
2382 GetSession()->SendPacket(&data);
2383}
@ SMSG_LOG_XPGAIN
Definition Opcodes.h:494

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), WorldSession::SendPacket(), and SMSG_LOG_XPGAIN.

Referenced by GiveXP().

◆ SendLoot()

void Player::SendLoot ( ObjectGuid  guid,
LootType  loot_type 
)
7791{
7792 if (ObjectGuid lguid = GetLootGUID())
7793 m_session->DoLootRelease(lguid);
7794
7795 Loot* loot = 0;
7796 PermissionTypes permission = ALL_PERMISSION;
7797
7798 LOG_DEBUG("loot", "Player::SendLoot");
7799
7800 // remove FD and invisibility at all loots
7801 constexpr std::array<AuraType, 2> toRemove = {SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_FEIGN_DEATH};
7802 for (auto const& aura : toRemove)
7803 {
7804 RemoveAurasByType(aura);
7805 }
7806 // remove stealth only if looting a corpse
7807 if (loot_type == LOOT_CORPSE && !guid.IsItem())
7808 {
7810 }
7811
7812 if (guid.IsGameObject())
7813 {
7814 LOG_DEBUG("loot", "guid.IsGameObject");
7815 GameObject* go = GetMap()->GetGameObject(guid);
7816
7817 // not check distance for GO in case owned GO (fishing bobber case, for example)
7818 // And permit out of range GO with no owner in case fishing hole
7819 if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault()))
7820 {
7822 SendLootRelease(guid);
7823 return;
7824 }
7825
7826 loot = &go->loot;
7827
7828 // Xinef: loot was generated and respawntime has passed since then, allow to recreate loot
7829 // Xinef: to avoid bugs, this rule covers spawned gameobjects only
7830 if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < GameTime::GetGameTime().count())
7832
7833 if (go->getLootState() == GO_READY)
7834 {
7835 uint32 lootid = go->GetGOInfo()->GetLootId();
7836
7837 //TODO: fix this big hack
7839 if (Battleground* bg = GetBattleground())
7840 if (bg->GetBgTypeID(true) == BATTLEGROUND_AV)
7841 if (!bg->ToBattlegroundAV()->PlayerCanDoMineQuest(go->GetEntry(), GetTeamId()))
7842 {
7844 SendLootRelease(guid);
7845 return;
7846 }
7847
7848 if (lootid)
7849 {
7850 loot->clear();
7851
7852 Group* group = GetGroup();
7853 bool groupRules = (group && go->GetGOInfo()->type == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.groupLootRules);
7854
7855 // check current RR player and get next if necessary
7856 if (groupRules)
7857 group->UpdateLooterGuid(go, true);
7858
7859 loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode(), go);
7861
7862 // get next RR player (for next loot)
7863 if (groupRules && !go->loot.empty())
7864 group->UpdateLooterGuid(go);
7865 }
7866 if (GameObjectTemplateAddon const* addon = go->GetTemplateAddon())
7867 loot->generateMoneyLoot(addon->mingold, addon->maxgold);
7868
7869 if (loot_type == LOOT_FISHING)
7870 go->GetFishLoot(loot, this);
7871 else if (loot_type == LOOT_FISHING_JUNK)
7872 go->GetFishLoot(loot, this, true);
7873
7875 {
7876 if (Group* group = GetGroup())
7877 {
7878 switch (group->GetLootMethod())
7879 {
7880 case GROUP_LOOT:
7881 // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin
7882 group->GroupLoot(loot, go);
7883 break;
7884 case NEED_BEFORE_GREED:
7885 group->NeedBeforeGreed(loot, go);
7886 break;
7887 case MASTER_LOOT:
7888 group->MasterLoot(loot, go);
7889 break;
7890 default:
7891 break;
7892 }
7893 }
7894 }
7895
7896 go->SetLootState(GO_ACTIVATED, this);
7897 }
7898
7899 if (go->getLootState() == GO_ACTIVATED)
7900 {
7901 if (Group* group = GetGroup())
7902 {
7903 switch (group->GetLootMethod())
7904 {
7905 case MASTER_LOOT:
7907 break;
7908 case FREE_FOR_ALL:
7909 permission = ALL_PERMISSION;
7910 break;
7911 case ROUND_ROBIN:
7912 permission = ROUND_ROBIN_PERMISSION;
7913 break;
7914 default:
7915 permission = GROUP_PERMISSION;
7916 break;
7917 }
7918 }
7919 else
7920 permission = ALL_PERMISSION;
7921 }
7922 }
7923 else if (guid.IsItem())
7924 {
7925 Item* item = GetItemByGuid(guid);
7926
7927 if (!item)
7928 {
7929 SendLootRelease(guid);
7930 return;
7931 }
7932
7933 permission = OWNER_PERMISSION;
7934
7935 loot = &item->loot;
7936
7937 // Xinef: Store container id
7938 loot->containerGUID = item->GetGUID();
7939
7940 if (!item->m_lootGenerated && !sLootItemStorage->LoadStoredLoot(item, this))
7941 {
7942 item->m_lootGenerated = true;
7943 loot->clear();
7944
7945 switch (loot_type)
7946 {
7947 case LOOT_DISENCHANTING:
7948 loot->FillLoot(item->GetTemplate()->DisenchantID, LootTemplates_Disenchant, this, true);
7949 break;
7950 case LOOT_PROSPECTING:
7951 loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this, true);
7952 break;
7953 case LOOT_MILLING:
7954 loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this, true);
7955 break;
7956 default:
7958 loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true, loot->gold != 0);
7959
7960 // Xinef: Add to storage
7961 if (loot->gold > 0 || loot->unlootedCount > 0)
7962 sLootItemStorage->AddNewStoredLoot(loot, this);
7963
7964 break;
7965 }
7966 }
7967 }
7968 else if (guid.IsCorpse()) // remove insignia
7969 {
7970 Corpse* bones = ObjectAccessor::GetCorpse(*this, guid);
7971
7972 if (!bones || !(loot_type == LOOT_CORPSE || loot_type == LOOT_INSIGNIA) || bones->GetType() != CORPSE_BONES || !bones->HasFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE))
7973 {
7974 SendLootRelease(guid);
7975 return;
7976 }
7977
7978 loot = &bones->loot;
7979
7980 if (loot->loot_type == LOOT_NONE)
7981 {
7982 uint32 pLevel = bones->loot.gold;
7983 bones->loot.clear();
7984
7985 loot->FillLoot(GetTeamId(), LootTemplates_Player, this, true);
7986
7987 // It may need a better formula
7988 // Now it works like this: lvl10: ~6copper, lvl70: ~9silver
7989 bones->loot.gold = uint32(urand(50, 150) * 0.016f * pow(float(pLevel) / 5.76f, 2.5f) * sWorld->getRate(RATE_DROP_MONEY));
7990 }
7991
7992 if (bones->lootRecipient != this)
7993 permission = NONE_PERMISSION;
7994 else
7995 permission = OWNER_PERMISSION;
7996 }
7997 else
7998 {
7999 Creature* creature = GetMap()->GetCreature(guid);
8000
8001 // must be in range and creature must be alive for pickpocket and must be dead for another loot
8002 if (!creature || creature->IsAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE))
8003 {
8004 SendLootRelease(guid);
8005 return;
8006 }
8007
8008 if (loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature))
8009 {
8010 SendLootRelease(guid);
8011 return;
8012 }
8013
8014 loot = &creature->loot;
8015
8016 if (loot_type == LOOT_PICKPOCKETING)
8017 {
8018 if (!loot || loot->loot_type != LOOT_PICKPOCKETING)
8019 {
8020 if (creature->CanGeneratePickPocketLoot())
8021 {
8022 creature->SetPickPocketLootTime();
8023 loot->clear();
8024
8025 if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId)
8026 loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true);
8027
8028 // Generate extra money for pick pocket loot
8029 const uint32 a = urand(0, creature->GetLevel() / 2);
8030 const uint32 b = urand(0, GetLevel() / 2);
8031 loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
8032 permission = OWNER_PERMISSION;
8033 }
8034 else
8035 {
8036 permission = NONE_PERMISSION;
8038 return;
8039 }
8040 }
8041 }
8042 else
8043 {
8044 // Xinef: Exploit fix
8045 if (!creature->HasDynamicFlag(UNIT_DYNFLAG_LOOTABLE))
8046 {
8048 return;
8049 }
8050
8051 // the player whose group may loot the corpse
8052 Player* recipient = creature->GetLootRecipient();
8053 Group* recipientGroup = creature->GetLootRecipientGroup();
8054 if (!recipient && !recipientGroup)
8055 return;
8056
8057 if (loot->loot_type == LOOT_NONE)
8058 {
8059 // for creature, loot is filled when creature is killed.
8060 if (recipientGroup)
8061 {
8062 switch (recipientGroup->GetLootMethod())
8063 {
8064 case GROUP_LOOT:
8065 // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin
8066 recipientGroup->GroupLoot(loot, creature);
8067 break;
8068 case NEED_BEFORE_GREED:
8069 recipientGroup->NeedBeforeGreed(loot, creature);
8070 break;
8071 case MASTER_LOOT:
8072 recipientGroup->MasterLoot(loot, creature);
8073 break;
8074 default:
8075 break;
8076 }
8077 }
8078 }
8079
8080 // if loot is already skinning loot then don't do anything else
8081 if (loot->loot_type == LOOT_SKINNING)
8082 {
8083 loot_type = LOOT_SKINNING;
8084 permission = creature->GetLootRecipientGUID() == GetGUID() ? OWNER_PERMISSION : NONE_PERMISSION;
8085 }
8086 else if (loot_type == LOOT_SKINNING)
8087 {
8088 loot->clear();
8089 loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true);
8090 permission = OWNER_PERMISSION;
8091
8092 //Inform instance if creature is skinned.
8093 if (InstanceScript* mapInstance = creature->GetInstanceScript())
8094 {
8095 mapInstance->CreatureLooted(creature, LOOT_SKINNING);
8096 }
8097
8098 // Xinef: Set new loot recipient
8099 creature->SetLootRecipient(this, false);
8100 }
8101 // set group rights only for loot_type != LOOT_SKINNING
8102 else
8103 {
8104 if (recipientGroup)
8105 {
8106 if (GetGroup() == recipientGroup)
8107 {
8108 switch (recipientGroup->GetLootMethod())
8109 {
8110 case MASTER_LOOT:
8111 permission = recipientGroup->GetMasterLooterGuid() == GetGUID() ? MASTER_PERMISSION : RESTRICTED_PERMISSION;
8112 break;
8113 case FREE_FOR_ALL:
8114 permission = ALL_PERMISSION;
8115 break;
8116 case ROUND_ROBIN:
8117 permission = ROUND_ROBIN_PERMISSION;
8118 break;
8119 default:
8120 permission = GROUP_PERMISSION;
8121 break;
8122 }
8123 }
8124 else
8125 permission = NONE_PERMISSION;
8126 }
8127 else if (recipient == this)
8128 permission = OWNER_PERMISSION;
8129 else
8130 permission = NONE_PERMISSION;
8131 }
8132 }
8133 }
8134
8135 // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
8136 switch (loot_type)
8137 {
8138 case LOOT_INSIGNIA:
8139 loot_type = LOOT_SKINNING;
8140 break;
8141 case LOOT_FISHINGHOLE:
8142 loot_type = LOOT_FISHING;
8143 break;
8144 case LOOT_FISHING_JUNK:
8145 loot_type = LOOT_FISHING;
8146 break;
8147 default:
8148 break;
8149 }
8150
8151 // need know merged fishing/corpse loot type for achievements
8152 loot->loot_type = loot_type;
8153
8154 if (!sScriptMgr->OnAllowedToLootContainerCheck(this, guid))
8155 {
8157 return;
8158 }
8159
8160 if (permission != NONE_PERMISSION)
8161 {
8162 SetLootGUID(guid);
8163
8164 WorldPacket data(SMSG_LOOT_RESPONSE, (9 + 50)); // we guess size
8165 data << guid;
8166 data << uint8(loot_type);
8167 data << LootView(*loot, this, permission);
8168
8169 SendDirectMessage(&data);
8170
8171 // add 'this' player as one of the players that are looting 'loot'
8172 loot->AddLooter(GetGUID());
8173
8174 if (loot_type == LOOT_CORPSE && !guid.IsItem())
8176 }
8177 else
8179}
@ BG_AV_OBJECTID_MINE_N
Definition BattlegroundAV.h:156
@ BG_AV_OBJECTID_MINE_S
Definition BattlegroundAV.h:157
@ CORPSE_BONES
Definition Corpse.h:28
@ GO_ACTIVATED
Definition GameObject.h:112
@ GO_READY
Definition GameObject.h:111
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
LootStore LootTemplates_Player("player_loot_template", "team id", true)
PermissionTypes
Definition LootMgr.h:66
@ OWNER_PERMISSION
Definition LootMgr.h:72
@ ALL_PERMISSION
Definition LootMgr.h:67
@ RESTRICTED_PERMISSION
Definition LootMgr.h:70
@ NONE_PERMISSION
Definition LootMgr.h:73
@ ROUND_ROBIN_PERMISSION
Definition LootMgr.h:71
@ MASTER_PERMISSION
Definition LootMgr.h:69
@ GROUP_PERMISSION
Definition LootMgr.h:68
@ LOOT_ERROR_DIDNT_KILL
Definition LootMgr.h:96
@ LOOT_ERROR_ALREADY_PICKPOCKETED
Definition LootMgr.h:107
@ LOOT_PICKPOCKETING
Definition LootMgr.h:81
@ LOOT_MILLING
Definition LootMgr.h:87
@ LOOT_FISHING_JUNK
Definition LootMgr.h:91
@ LOOT_CORPSE
Definition LootMgr.h:80
@ LOOT_FISHING
Definition LootMgr.h:82
@ LOOT_DISENCHANTING
Definition LootMgr.h:83
@ LOOT_FISHINGHOLE
Definition LootMgr.h:89
@ LOOT_NONE
Definition LootMgr.h:78
@ LOOT_PROSPECTING
Definition LootMgr.h:86
@ GAMEOBJECT_TYPE_CHEST
Definition SharedDefines.h:1563
@ UNIT_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3360
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
@ SPELL_AURA_FEIGN_DEATH
Definition SpellAuraDefines.h:129
@ SPELL_AURA_MOD_STEALTH
Definition SpellAuraDefines.h:79
@ GAMEOBJECT_BYTES_1
Definition UpdateFields.h:404
@ RATE_DROP_MONEY
Definition WorldConfig.h:417
Loot loot
Definition Creature.h:230
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition Creature.cpp:1331
ObjectGuid GetLootRecipientGUID() const
Definition Creature.h:231
void SetPickPocketLootTime()
Definition Creature.cpp:3790
Player * GetLootRecipient() const
Definition Creature.cpp:1317
bool CanGeneratePickPocketLoot() const
Definition Creature.cpp:3795
Group * GetLootRecipientGroup() const
Definition Creature.cpp:1324
uint32 GetRespawnDelay() const
Definition GameObject.h:197
bool IsWithinDistInMap(Player const *player) const
Definition GameObject.cpp:2988
Loot loot
Definition GameObject.h:246
LootState getLootState() const
Definition GameObject.h:223
bool isSpawnedByDefault() const
Definition GameObject.h:195
void GetFishLoot(Loot *fishLoot, Player *lootOwner, bool junk=false)
Definition GameObject.cpp:1005
time_t GetRespawnTime() const
Definition GameObject.h:183
uint32 GetLootGenerationTime() const
Definition GameObject.h:257
void SetLootState(LootState s, Unit *unit=nullptr)
Definition GameObject.cpp:2427
ObjectGuid GetOwnerGUID() const
Definition GameObject.h:173
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition GameObject.cpp:915
void SetLootGenerationTime()
Definition GameObject.cpp:2917
uint16 GetLootMode() const
Definition GameObject.h:227
void NeedBeforeGreed(Loot *loot, WorldObject *pLootedObject)
Definition Group.cpp:1159
ObjectGuid GetMasterLooterGuid() const
Definition Group.cpp:2325
void GroupLoot(Loot *loot, WorldObject *pLootedObject)
Definition Group.cpp:1003
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition Group.cpp:1867
void MasterLoot(Loot *loot, WorldObject *pLootedObject)
Definition Group.cpp:1310
Loot loot
Definition Item.h:320
bool IsCorpse() const
Definition ObjectGuid.h:173
bool IsItem() const
Definition ObjectGuid.h:170
bool IsGameObject() const
Definition ObjectGuid.h:171
bool HasDynamicFlag(uint32 flag) const
Definition Object.h:123
void ForceValuesUpdateAtIndex(uint32)
Definition Object.cpp:2035
void SendLootRelease(ObjectGuid guid)
Definition Player.cpp:7783
void SetLootGUID(ObjectGuid guid)
Definition Player.h:2012
void SendLootError(ObjectGuid guid, LootError error)
Definition Player.cpp:8181
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:10302
@ SMSG_LOOT_RESPONSE
Definition Opcodes.h:382
Corpse * GetCorpse(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:179
uint32 SkinLootId
Definition CreatureData.h:226
uint32 pickpocketLootId
Definition CreatureData.h:225
Definition GameObjectData.h:664
uint32 type
Definition GameObjectData.h:33
uint32 groupLootRules
Definition GameObjectData.h:98
struct GameObjectTemplate::@231::@236 chest
uint32 GetLootId() const
Definition GameObjectData.h:539
uint32 DisenchantID
Definition ItemTemplate.h:690
uint32 MinMoneyLoot
Definition ItemTemplate.h:692
uint32 MaxMoneyLoot
Definition ItemTemplate.h:693
Definition LootMgr.h:405
void AddLooter(ObjectGuid GUID)
Definition LootMgr.h:373
ObjectGuid containerGUID
Definition LootMgr.h:329
bool empty() const
Definition LootMgr.h:367
void clear()
Definition LootMgr.h:343
uint8 unlootedCount
Definition LootMgr.h:323
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition LootMgr.cpp:838

References Loot::AddLooter(), ALL_PERMISSION, BATTLEGROUND_AV, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, Creature::CanGeneratePickPocketLoot(), GameObjectTemplate::chest, Loot::clear(), Loot::containerGUID, CORPSE_BONES, CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, ItemTemplate::DisenchantID, WorldSession::DoLootRelease(), Loot::empty(), Loot::FillLoot(), Object::ForceValuesUpdateAtIndex(), FREE_FOR_ALL, GAMEOBJECT_BYTES_1, GAMEOBJECT_TYPE_CHEST, Loot::generateMoneyLoot(), GetBattleground(), ObjectAccessor::GetCorpse(), Map::GetCreature(), Creature::GetCreatureTemplate(), Object::GetEntry(), GameObject::GetFishLoot(), Map::GetGameObject(), GameTime::GetGameTime(), GameObject::GetGOInfo(), GetGroup(), Object::GetGUID(), Object::GetGUID(), WorldObject::GetInstanceScript(), GetItemByGuid(), Unit::GetLevel(), GameObject::GetLootGenerationTime(), GetLootGUID(), GameObjectTemplate::GetLootId(), Group::GetLootMethod(), GameObject::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), Creature::GetLootRecipientGUID(), GameObject::getLootState(), WorldObject::GetMap(), Group::GetMasterLooterGuid(), GameObject::GetOwnerGUID(), GameObject::GetRespawnDelay(), GameObject::GetRespawnTime(), GetTeamId(), Item::GetTemplate(), GameObject::GetTemplateAddon(), Corpse::GetType(), GO_ACTIVATED, GO_READY, Loot::gold, GROUP_LOOT, GROUP_PERMISSION, Group::GroupLoot(), GameObjectTemplate::groupLootRules, Object::HasDynamicFlag(), Object::HasFlag(), INTERACTION_DISTANCE, Unit::IsAlive(), ObjectGuid::IsCorpse(), Unit::IsFriendlyTo(), ObjectGuid::IsGameObject(), ObjectGuid::IsItem(), Loot::isLooted(), GameObject::isSpawnedByDefault(), GameObject::IsWithinDistInMap(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, Corpse::loot, Creature::loot, GameObject::loot, Item::loot, LOOT_CORPSE, LOOT_DISENCHANTING, LOOT_ERROR_ALREADY_PICKPOCKETED, LOOT_ERROR_DIDNT_KILL, LOOT_FISHING, LOOT_FISHING_JUNK, LOOT_FISHINGHOLE, LOOT_INSIGNIA, LOOT_MILLING, LOOT_NONE, LOOT_PICKPOCKETING, LOOT_PROSPECTING, LOOT_SKINNING, Loot::loot_type, Corpse::lootRecipient, LootTemplates_Disenchant, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Milling, LootTemplates_Pickpocketing, LootTemplates_Player, LootTemplates_Prospecting, LootTemplates_Skinning, Item::m_lootGenerated, m_session, MASTER_LOOT, MASTER_PERMISSION, Group::MasterLoot(), ItemTemplate::MaxMoneyLoot, ItemTemplate::MinMoneyLoot, NEED_BEFORE_GREED, Group::NeedBeforeGreed(), NONE_PERMISSION, OWNER_PERMISSION, CreatureTemplate::pickpocketLootId, RATE_DROP_MONEY, Unit::RemoveAurasByType(), RESTRICTED_PERMISSION, ROUND_ROBIN, ROUND_ROBIN_PERMISSION, SendDirectMessage(), SendLootError(), SendLootRelease(), GameObject::SetLootGenerationTime(), SetLootGUID(), Creature::SetLootRecipient(), GameObject::SetLootState(), Creature::SetPickPocketLootTime(), Unit::SetUnitFlag(), CreatureTemplate::SkinLootId, sLootItemStorage, SMSG_LOOT_RESPONSE, SPELL_AURA_FEIGN_DEATH, SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_MOD_STEALTH, sScriptMgr, sWorld, GameObjectTemplate::type, UNIT_DYNFLAG_LOOTABLE, UNIT_FLAG_LOOTING, Loot::unlootedCount, Group::UpdateLooterGuid(), and urand().

Referenced by Spell::EffectMilling(), Spell::EffectPickPocket(), Spell::EffectProspecting(), Spell::EffectSkinning(), WorldSession::HandleLootOpcode(), WorldSession::HandleOpenItemOpcode(), go_hive_pod::OnGossipHello(), RemovedInsignia(), Spell::SendLoot(), and GameObject::Use().

◆ SendLootError()

void Player::SendLootError ( ObjectGuid  guid,
LootError  error 
)

◆ SendLootRelease()

void Player::SendLootRelease ( ObjectGuid  guid)
7784{
7786 data << guid << uint8(1);
7787 SendDirectMessage(&data);
7788}
@ SMSG_LOOT_RELEASE_RESPONSE
Definition Opcodes.h:383

References SendDirectMessage(), and SMSG_LOOT_RELEASE_RESPONSE.

Referenced by WorldSession::DoLootRelease(), WorldSession::HandleAutostoreLootItemOpcode(), SendLoot(), and StoreLootItem().

◆ SendMailResult()

void Player::SendMailResult ( uint32  mailId,
MailResponseType  mailAction,
MailResponseResult  mailError,
uint32  equipError = 0,
ObjectGuid::LowType  item_guid = 0,
uint32  item_count = 0 
)
2874{
2875 WorldPacket data(SMSG_SEND_MAIL_RESULT, (4 + 4 + 4 + (mailError == MAIL_ERR_EQUIP_ERROR ? 4 : (mailAction == MAIL_ITEM_TAKEN ? 4 + 4 : 0))));
2876 data << (uint32) mailId;
2877 data << (uint32) mailAction;
2878 data << (uint32) mailError;
2879 if (mailError == MAIL_ERR_EQUIP_ERROR)
2880 data << (uint32) equipError;
2881 else if (mailAction == MAIL_ITEM_TAKEN)
2882 {
2883 data << (uint32) item_guid; // item guid low?
2884 data << (uint32) item_count; // item count?
2885 }
2886 GetSession()->SendPacket(&data);
2887}
@ MAIL_ITEM_TAKEN
Definition SharedDefines.h:3757
@ MAIL_ERR_EQUIP_ERROR
Definition SharedDefines.h:3766
@ SMSG_SEND_MAIL_RESULT
Definition Opcodes.h:599

References GetSession(), MAIL_ERR_EQUIP_ERROR, MAIL_ITEM_TAKEN, WorldSession::SendPacket(), and SMSG_SEND_MAIL_RESULT.

Referenced by WorldSession::HandleMailCreateTextItem(), WorldSession::HandleMailDelete(), WorldSession::HandleMailReturnToSender(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), and WorldSession::HandleSendMail().

◆ SendMessageToSet() [1/2]

◆ SendMessageToSet() [2/2]

void Player::SendMessageToSet ( WorldPacket const *  data,
Player const *  skipped_rcvr 
) const
overridevirtual

Reimplemented from WorldObject.

5717{
5718 if (skipped_rcvr != this)
5719 SendDirectMessage(data);
5720
5721 Acore::MessageDistDeliverer notifier(this, data, 0.0f, false, skipped_rcvr);
5722 notifier.Visit(GetObjectVisibilityContainer().GetVisiblePlayersMap());
5723}

References WorldObject::GetObjectVisibilityContainer(), SendDirectMessage(), and Acore::MessageDistDeliverer::Visit().

◆ SendMessageToSetInRange()

void Player::SendMessageToSetInRange ( WorldPacket const *  data,
float  dist,
bool  self 
) const
overridevirtual

Reimplemented from WorldObject.

5708{
5709 if (self)
5710 SendDirectMessage(data);
5711
5712 Acore::MessageDistDeliverer notifier(this, data, dist);
5713 notifier.Visit(GetObjectVisibilityContainer().GetVisiblePlayersMap());
5714}

References WorldObject::GetObjectVisibilityContainer(), SendDirectMessage(), and Acore::MessageDistDeliverer::Visit().

Referenced by AchievementMgr::SendAchievementEarned(), and SendMessageToSet().

◆ SendMirrorTimer()

void Player::SendMirrorTimer ( MirrorTimerType  Type,
uint32  MaxValue,
uint32  CurrentValue,
int32  Regen 
)
protected
742{
743 if (int(MaxValue) == DISABLED_MIRROR_TIMER)
744 {
745 if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
746 StopMirrorTimer(Type);
747 return;
748 }
749 SendDirectMessage(WorldPackets::Misc::StartMirrorTimer(Type, CurrentValue, MaxValue, Regen, 0, 0).Write());
750}
Definition MiscPackets.h:121

References DISABLED_MIRROR_TIMER, SendDirectMessage(), and StopMirrorTimer().

Referenced by HandleDrowning().

◆ SendMovieStart()

void Player::SendMovieStart ( uint32  MovieId)
5742{
5744 data << uint32(MovieId);
5745 SendDirectMessage(&data);
5746}
@ SMSG_TRIGGER_MOVIE
Definition Opcodes.h:1154

References SendDirectMessage(), and SMSG_TRIGGER_MOVIE.

Referenced by debug_commandscript::HandleDebugPlayMovieCommand().

◆ SendNewItem()

void Player::SendNewItem ( Item item,
uint32  count,
bool  received,
bool  created,
bool  broadcast = false,
bool  sendChatMessage = true 
)
4758{
4759 if (!item) // prevent crash
4760 return;
4761
4762 // last check 2.0.10
4763 WorldPacket data(SMSG_ITEM_PUSH_RESULT, (8 + 4 + 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4));
4764 data << GetGUID(); // player GUID
4765 data << uint32(received); // 0=looted, 1=from npc
4766 data << uint32(created); // 0=received, 1=created
4767 data << uint32(sendChatMessage); // bool print message to chat
4768 data << uint8(item->GetBagSlot()); // bagslot
4769 // item slot, but when added to stack: 0xFFFFFFFF
4770 data << uint32((item->GetCount() == count) ? item->GetSlot() : -1);
4771 data << uint32(item->GetEntry()); // item id
4772 data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
4773 data << int32(item->GetItemRandomPropertyId()); // random item property id
4774 data << uint32(count); // count of items
4775 data << uint32(GetItemCount(item->GetEntry())); // count of items in inventory
4776
4777 if (broadcast && GetGroup())
4778 GetGroup()->BroadcastPacket(&data, true);
4779 else
4780 GetSession()->SendPacket(&data);
4781}
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition Group.cpp:1756
@ SMSG_ITEM_PUSH_RESULT
Definition Opcodes.h:388

References Group::BroadcastPacket(), Item::GetBagSlot(), Item::GetCount(), Object::GetEntry(), GetGroup(), Object::GetGUID(), GetItemCount(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), GetSession(), Item::GetSlot(), WorldSession::SendPacket(), and SMSG_ITEM_PUSH_RESULT.

Referenced by _StoreOrEquipNewItem(), AddItem(), AutoStoreLoot(), Spell::DoCreateItem(), GiveQuestSourceItem(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), AuraEffect::HandleChannelDeathItem(), OPvPCapturePointNA::HandleCustomSpell(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandlePetitionBuyOpcode(), RefundItem(), RemovePet(), RewardQuest(), npc_oculus_drakegiver::StoreEssence(), and StoreLootItem().

◆ SendNewMail()

void Player::SendNewMail ( )
2890{
2891 // deliver undelivered mail
2893 data << (uint32) 0;
2894 GetSession()->SendPacket(&data);
2895}
@ SMSG_RECEIVED_MAIL
Definition Opcodes.h:675

References GetSession(), WorldSession::SendPacket(), and SMSG_RECEIVED_MAIL.

Referenced by AddNewMailDeliverTime(), and Update().

◆ SendNotifyLootItemRemoved()

void Player::SendNotifyLootItemRemoved ( uint8  lootSlot)
8197{
8199 data << uint8(lootSlot);
8200 GetSession()->SendPacket(&data);
8201}
@ SMSG_LOOT_REMOVED
Definition Opcodes.h:384

References GetSession(), WorldSession::SendPacket(), and SMSG_LOOT_REMOVED.

Referenced by Loot::NotifyItemRemoved(), Loot::NotifyQuestItemRemoved(), and StoreLootItem().

◆ SendNotifyLootMoneyRemoved()

void Player::SendNotifyLootMoneyRemoved ( )
8191{
8193 GetSession()->SendPacket(&data);
8194}
@ SMSG_LOOT_CLEAR_MONEY
Definition Opcodes.h:387

References GetSession(), WorldSession::SendPacket(), and SMSG_LOOT_CLEAR_MONEY.

Referenced by Loot::NotifyMoneyRemoved().

◆ SendPreparedGossip()

void Player::SendPreparedGossip ( WorldObject source)
210{
211 if (!source)
212 return;
213
214 if (source->IsCreature())
215 {
216 // in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag)
218 {
219 SendPreparedQuest(source->GetGUID());
220 return;
221 }
222 }
223 else if (source->IsGameObject())
224 {
225 // probably need to find a better way here
227 {
228 SendPreparedQuest(source->GetGUID());
229 return;
230 }
231 }
232
233 // in case non empty gossip menu (that not included quests list size) show it
234 // (quest entries from quest menu will be included in list)
235
236 uint32 textId = GetGossipTextId(source);
237
239 textId = GetGossipTextId(menuId, source);
240
241 PlayerTalkClass->SendGossipMenu(textId, source->GetGUID());
242}
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:315
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
Definition GossipDef.cpp:193
bool Empty() const
Definition GossipDef.h:242

References QuestMenu::Empty(), PlayerMenu::GetGossipMenu(), GetGossipTextId(), Object::GetGUID(), GossipMenu::GetMenuId(), PlayerMenu::GetQuestMenu(), Unit::HasNpcFlag(), Object::IsCreature(), Object::IsGameObject(), PlayerTalkClass, PlayerMenu::SendGossipMenu(), SendPreparedQuest(), Object::ToCreature(), and UNIT_NPC_FLAG_GOSSIP.

Referenced by WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), npc_thrall_old_hillsbrad::OnGossipHello(), go_apexis_relic::OnGossipHello(), OnGossipSelect(), Spell::SendLoot(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and GameObject::Use().

◆ SendPreparedQuest()

void Player::SendPreparedQuest ( ObjectGuid  guid)
Todo:
verify if check for !quest->IsDaily() is really correct (possibly not)
116{
117 QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu();
118 if (questMenu.Empty())
119 return;
120
121 // single element case
122 if (questMenu.GetMenuItemCount() == 1)
123 {
124 QuestMenuItem const& qmi0 = questMenu.GetItem(0);
125 uint32 questId = qmi0.QuestId;
126
127 // Auto open -- maybe also should verify there is no greeting
128 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
129 {
130 if (qmi0.QuestIcon == 4)
131 PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanRewardQuest(quest, false), true);
132 // Send completable on repeatable and autoCompletable quest if player don't have quest
134 else
135 {
137 if (!object || (!object->hasQuest(questId) && !object->hasInvolvedQuest(questId)))
138 {
140 return;
141 }
142
143 if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true))
144 AddQuestAndCheckCompletion(quest, object);
145
146 if (quest->IsAutoComplete() || !quest->GetQuestMethod())
148 else
150 }
151 }
152 }
153 // multiple entries
154 else
155 {
156 QEmote qe;
157 qe._Delay = 0;
158 qe._Emote = 0;
159 std::string title = "";
160
161 // need pet case for some quests
163 if (creature)
164 {
165 uint32 textid = GetGossipTextId(creature);
166 GossipText const* gossiptext = sObjectMgr->GetGossipText(textid);
167 if (!gossiptext)
168 {
169 qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
170 qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
171 title = "";
172 }
173 else
174 {
175 qe = gossiptext->Options[0].Emotes[0];
176
177 if (!gossiptext->Options[0].Text_0.empty())
178 {
179 title = gossiptext->Options[0].Text_0;
180
181 int loc_idx = GetSession()->GetSessionDbLocaleIndex();
182 if (loc_idx >= 0)
183 if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textid))
184 ObjectMgr::GetLocaleString(npcTextLocale->Text_0[0], loc_idx, title);
185 }
186 else
187 {
188 title = gossiptext->Options[0].Text_1;
189
190 int loc_idx = GetSession()->GetSessionDbLocaleIndex();
191 if (loc_idx >= 0)
192 if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textid))
193 ObjectMgr::GetLocaleString(npcTextLocale->Text_1[0], loc_idx, title);
194 }
195 }
196 }
197
199 }
200}
@ TYPEMASK_ITEM
Definition ObjectGuid.h:47
@ TYPEMASK_UNIT
Definition ObjectGuid.h:49
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:51
Definition Object.h:104
virtual bool hasQuest(uint32) const
Definition Object.h:190
virtual bool hasInvolvedQuest(uint32) const
Definition Object.h:191
void SendQuestGiverQuestList(QEmote const &eEmote, std::string const &Title, ObjectGuid guid)
Definition GossipDef.cpp:315
void SendQuestGiverQuestDetails(Quest const *quest, ObjectGuid npcGUID, bool activateAccept) const
Definition GossipDef.cpp:388
void SendQuestGiverRequestItems(Quest const *quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
Definition GossipDef.cpp:752
bool CanAddQuest(Quest const *quest, bool msg)
Definition PlayerQuest.cpp:264
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition PlayerQuest.cpp:421
bool CanCompleteRepeatableQuest(Quest const *quest)
Definition PlayerQuest.cpp:366
QuestMenuItem const & GetItem(uint16 index) const
Definition GossipDef.h:249
uint8 GetMenuItemCount() const
Definition GossipDef.h:237
std::string Text_0
Definition NPCHandler.h:34
QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES]
Definition NPCHandler.h:39
std::string Text_1
Definition NPCHandler.h:35
Definition NPCHandler.h:45
GossipTextOption Options[MAX_GOSSIP_TEXT_OPTIONS]
Definition NPCHandler.h:46
Definition NPCHandler.h:55
Definition NPCHandler.h:25
uint32 _Emote
Definition NPCHandler.h:26
uint32 _Delay
Definition NPCHandler.h:27
Definition GossipDef.h:155
uint32 QuestId
Definition GossipDef.h:156
uint8 QuestIcon
Definition GossipDef.h:157

References QEmote::_Delay, QEmote::_Emote, AddQuestAndCheckCompletion(), CanAddQuest(), CanCompleteRepeatableQuest(), CanRewardQuest(), CanTakeQuest(), GossipTextOption::Emotes, QuestMenu::Empty(), ObjectAccessor::GetCreatureOrPetOrVehicle(), GetGossipTextId(), QuestMenu::GetItem(), ObjectMgr::GetLocaleString(), QuestMenu::GetMenuItemCount(), ObjectAccessor::GetObjectByTypeMask(), PlayerMenu::GetQuestMenu(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Object::hasInvolvedQuest(), Object::hasQuest(), GossipText::Options, PlayerTalkClass, QuestMenuItem::QuestIcon, QuestMenuItem::QuestId, PlayerMenu::SendCloseGossip(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestGiverQuestList(), PlayerMenu::SendQuestGiverRequestItems(), sObjectMgr, GossipTextOption::Text_0, GossipTextOption::Text_1, TYPEMASK_GAMEOBJECT, TYPEMASK_ITEM, and TYPEMASK_UNIT.

Referenced by npc_cos_chromie_middle::OnGossipHello(), OnGossipSelect(), SendPreparedGossip(), npc_costumed_orphan_matron::sGossipHello(), and npc_maredis_firestar::npc_maredis_firestarAI::sGossipSelect().

◆ SendProficiency()

void Player::SendProficiency ( ItemClass  itemClass,
uint32  itemSubclassMask 
)
10091{
10092 WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4);
10093 data << uint8(itemClass) << uint32(itemSubclassMask);
10094 GetSession()->SendPacket(&data);
10095}
@ SMSG_SET_PROFICIENCY
Definition Opcodes.h:325

References GetSession(), WorldSession::SendPacket(), and SMSG_SET_PROFICIENCY.

Referenced by Spell::EffectProficiency().

◆ SendPushToPartyResponse()

void Player::SendPushToPartyResponse ( Player const *  player,
uint8  msg 
) const
2436{
2437 if (player)
2438 {
2439 WorldPacket data(MSG_QUEST_PUSH_RESULT, (8 + 1));
2440 data << player->GetGUID();
2441 data << uint8(msg); // valid values: 0-8
2442 GetSession()->SendPacket(&data);
2443 LOG_DEBUG("network", "WORLD: Sent MSG_QUEST_PUSH_RESULT");
2444 }
2445}
@ MSG_QUEST_PUSH_RESULT
Definition Opcodes.h:660

References Object::GetGUID(), GetSession(), LOG_DEBUG, MSG_QUEST_PUSH_RESULT, and WorldSession::SendPacket().

Referenced by CanShareQuest(), debug_commandscript::HandleDebugSendQuestPartyMsgCommand(), WorldSession::HandlePushQuestToParty(), and WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ SendQuestComplete()

void Player::SendQuestComplete ( uint32  quest_id)
2347{
2348 if (quest_id)
2349 {
2351 data << uint32(quest_id);
2352 GetSession()->SendPacket(&data);
2353 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = {}", quest_id);
2354 }
2355}
@ SMSG_QUESTUPDATE_COMPLETE
Definition Opcodes.h:438

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_COMPLETE.

Referenced by AreaExploredOrEventHappens().

◆ SendQuestConfirmAccept()

void Player::SendQuestConfirmAccept ( Quest const *  quest,
Player pReceiver 
)
2414{
2415 if (pReceiver)
2416 {
2417 //load locale from db
2418 std::string strTitle = quest->GetTitle();
2419
2420 int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex();
2421 if (loc_idx >= 0)
2422 if (const QuestLocale* pLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
2423 ObjectMgr::GetLocaleString(pLocale->Title, loc_idx, strTitle);
2424
2425 WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + quest->GetTitle().size() + 8));
2426 data << uint32(quest->GetQuestId());
2427 data << quest->GetTitle();
2428 data << GetGUID();
2429 pReceiver->GetSession()->SendPacket(&data);
2430
2431 LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT");
2432 }
2433}
@ SMSG_QUEST_CONFIRM_ACCEPT
Definition Opcodes.h:442

References Object::GetGUID(), ObjectMgr::GetLocaleString(), Quest::GetQuestId(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Quest::GetTitle(), LOG_DEBUG, WorldSession::SendPacket(), SMSG_QUEST_CONFIRM_ACCEPT, and sObjectMgr.

Referenced by WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ SendQuestFailed()

void Player::SendQuestFailed ( uint32  questId,
InventoryResult  reason = EQUIP_ERR_OK 
)
2383{
2384 if (questId)
2385 {
2387 data << uint32(questId);
2388 data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message)
2389 GetSession()->SendPacket(&data);
2390 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED");
2391 }
2392}
@ SMSG_QUESTGIVER_QUEST_FAILED
Definition Opcodes.h:432

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTGIVER_QUEST_FAILED.

Referenced by FailQuest().

◆ SendQuestGiverStatusMultiple()

void Player::SendQuestGiverStatusMultiple ( )
protected
7703{
7704 if (GetObjectVisibilityContainer().GetVisibleWorldObjectsMap()->empty())
7705 return;
7706
7707 uint32 count = 0;
7708
7710 data << uint32(count); // placeholder
7711
7712 DoForAllVisibleWorldObjects([this, &data, &count](WorldObject* worldObject)
7713 {
7714 uint32 questStatus = DIALOG_STATUS_NONE;
7715
7716 if (worldObject->IsCreature())
7717 {
7718 // need also pet quests case support
7719 Creature* questgiver = worldObject->ToCreature();
7720 if (!questgiver || questgiver->IsHostileTo(this))
7721 return;
7722 if (!questgiver->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))
7723 return;
7724
7725 questStatus = GetQuestDialogStatus(questgiver);
7726
7727 data << questgiver->GetGUID();
7728 data << uint8(questStatus);
7729 ++count;
7730 }
7731 else if (worldObject->IsGameObject())
7732 {
7733 GameObject* questgiver = worldObject->ToGameObject();
7734 if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
7735 return;
7736
7737 questStatus = GetQuestDialogStatus(questgiver);
7738
7739 data << questgiver->GetGUID();
7740 data << uint8(questStatus);
7741 ++count;
7742 }
7743 });
7744
7745 data.put<uint32>(0, count); // write real count
7746 GetSession()->SendPacket(&data);
7747}
void DoForAllVisibleWorldObjects(Worker &&worker)
Definition Object.h:572
@ SMSG_QUESTGIVER_STATUS_MULTIPLE
Definition Opcodes.h:1078

References DIALOG_STATUS_NONE, WorldObject::DoForAllVisibleWorldObjects(), WorldObject::GetObjectVisibilityContainer(), GetSession(), Object::IsCreature(), Object::IsGameObject(), ByteBuffer::put(), WorldSession::SendPacket(), and SMSG_QUESTGIVER_STATUS_MULTIPLE.

Referenced by GiveLevel(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleQuestgiverStatusMultipleQuery(), RewardQuest(), and SendInitialPacketsAfterAddToMap().

◆ SendQuestReward()

void Player::SendQuestReward ( Quest const *  quest,
uint32  XP 
)
2358{
2359 uint32 questid = quest->GetQuestId();
2360 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = {}", questid);
2361 sGameEventMgr->HandleQuestComplete(questid);
2362 WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4 + 4 + 4 + 4 + 4));
2363 data << uint32(questid);
2364
2365 if (!IsMaxLevel())
2366 {
2367 data << uint32(XP);
2368 data << uint32(quest->GetRewOrReqMoney(GetLevel()));
2369 }
2370 else
2371 {
2372 data << uint32(0);
2373 data << uint32(quest->GetRewOrReqMoney(GetLevel()) + quest->GetRewMoneyMaxLevel());
2374 }
2375
2376 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
2377 data << uint32(quest->GetBonusTalents()); // bonus talents
2378 data << uint32(quest->GetRewArenaPoints());
2379 GetSession()->SendPacket(&data);
2380}
bool IsMaxLevel() const
Definition Player.cpp:2568
@ SMSG_QUESTGIVER_QUEST_COMPLETE
Definition Opcodes.h:431

References Quest::CalculateHonorGain(), Quest::GetBonusTalents(), Unit::GetLevel(), Quest::GetQuestId(), GetQuestLevel(), Quest::GetRewArenaPoints(), Quest::GetRewMoneyMaxLevel(), Quest::GetRewOrReqMoney(), GetSession(), IsMaxLevel(), LOG_DEBUG, WorldSession::SendPacket(), sGameEventMgr, and SMSG_QUESTGIVER_QUEST_COMPLETE.

Referenced by RewardQuest().

◆ SendQuestTimerFailed()

void Player::SendQuestTimerFailed ( uint32  quest_id)
2395{
2396 if (quest_id)
2397 {
2399 data << uint32(quest_id);
2400 GetSession()->SendPacket(&data);
2401 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER");
2402 }
2403}
@ SMSG_QUESTUPDATE_FAILEDTIMER
Definition Opcodes.h:437

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_FAILEDTIMER.

Referenced by FailQuest().

◆ SendQuestUpdate()

void Player::SendQuestUpdate ( uint32  questId)
1527{
1528 uint32 zone = 0, area = 0;
1529 // xinef: fixup
1530 uint32 oldSpellId = 0;
1531
1532 SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(questId);
1533 if (saBounds.first != saBounds.second)
1534 {
1535 GetZoneAndAreaId(zone, area);
1536
1537 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1538 {
1539 // xinef: spell was already casted, skip different areas with same spell
1540 if (itr->second->spellId == oldSpellId)
1541 continue;
1542 if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
1543 if (!HasAura(itr->second->spellId))
1544 {
1545 CastSpell(this, itr->second->spellId, true);
1546 oldSpellId = itr->second->spellId;
1547 }
1548 }
1549 }
1550
1551 saBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(questId);
1552
1553 // xinef: fixup
1554 uint32 skipSpellId = 0;
1555 oldSpellId = 0;
1556 if (saBounds.first != saBounds.second)
1557 {
1558 if (!zone || !area)
1559 GetZoneAndAreaId(zone, area);
1560
1561 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1562 {
1563 // xinef: skip spell for which condition is already fulfilled
1564 if (itr->second->spellId == skipSpellId)
1565 continue;
1566 skipSpellId = 0;
1567
1568 // xinef: spells are sorted, if no condition is fulfilled remove aura
1569 if (oldSpellId && oldSpellId != itr->second->spellId)
1570 {
1571 RemoveAurasDueToSpell(oldSpellId);
1572 oldSpellId = 0;
1573 }
1574
1575 if (!itr->second->IsFitToRequirements(this, zone, area))
1576 {
1577 //RemoveAurasDueToSpell(itr->second->spellId);
1578 oldSpellId = itr->second->spellId;
1579 }
1580 else
1581 {
1582 skipSpellId = itr->second->spellId;
1583 oldSpellId = 0;
1584 }
1585 }
1586
1587 // xinef: check if we have something to remove yet
1588 if (oldSpellId)
1589 RemoveAurasDueToSpell(oldSpellId);
1590 }
1591
1593}
std::pair< SpellAreaForQuestMap::const_iterator, SpellAreaForQuestMap::const_iterator > SpellAreaForQuestMapBounds
Definition SpellMgr.h:548

References Unit::CastSpell(), WorldObject::GetZoneAndAreaId(), Unit::HasAura(), Unit::RemoveAurasDueToSpell(), sSpellMgr, and UpdateForQuestWorldObjects().

Referenced by AddQuest(), RemoveActiveQuest(), RemoveRewardedQuest(), RewardQuest(), and SetQuestStatus().

◆ SendQuestUpdateAddCreatureOrGo()

void Player::SendQuestUpdateAddCreatureOrGo ( Quest const *  quest,
ObjectGuid  guid,
uint32  creatureOrGO_idx,
uint16  old_count,
uint16  add_count 
)
2457{
2458 ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
2459
2460 int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ];
2461 if (entry < 0)
2462 // client expected gameobject template id in form (id|0x80000000)
2463 entry = (-entry) | 0x80000000;
2464
2465 WorldPacket data(SMSG_QUESTUPDATE_ADD_KILL, (4 * 4 + 8));
2466 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL");
2467 data << uint32(quest->GetQuestId());
2468 data << uint32(entry);
2469 data << uint32(old_count + add_count);
2470 data << uint32(quest->RequiredNpcOrGoCount[ creatureOrGO_idx ]);
2471 data << guid;
2472 GetSession()->SendPacket(&data);
2473
2474 uint16 log_slot = FindQuestSlot(quest->GetQuestId());
2475 if (log_slot < MAX_QUEST_LOG_SIZE)
2476 SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx) + add_count);
2477}
uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const
Definition Player.h:1501
@ SMSG_QUESTUPDATE_ADD_KILL
Definition Opcodes.h:439

References ASSERT, FindQuestSlot(), Quest::GetQuestId(), GetQuestSlotCounter(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, WorldSession::SendPacket(), SetQuestSlotCounter(), and SMSG_QUESTUPDATE_ADD_KILL.

Referenced by KillCreditGO(), KilledMonsterCredit(), and TalkedToCreature().

◆ SendQuestUpdateAddItem()

void Player::SendQuestUpdateAddItem ( Quest const *  quest,
uint32  item_idx,
uint16  count 
)
2448{
2450 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM");
2451 //data << quest->RequiredItemId[item_idx];
2452 //data << count;
2453 GetSession()->SendPacket(&data);
2454}
@ SMSG_QUESTUPDATE_ADD_ITEM
Definition Opcodes.h:440

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_ADD_ITEM.

◆ SendQuestUpdateAddPlayer()

void Player::SendQuestUpdateAddPlayer ( Quest const *  quest,
uint16  old_count,
uint16  add_count 
)
2480{
2481 ASSERT(old_count + add_count < 65536 && "player count store in 16 bits");
2482
2484 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL");
2485 data << uint32(quest->GetQuestId());
2486 data << uint32(old_count + add_count);
2487 data << uint32(quest->GetPlayersSlain());
2488 GetSession()->SendPacket(&data);
2489
2490 uint16 log_slot = FindQuestSlot(quest->GetQuestId());
2491 if (log_slot < MAX_QUEST_LOG_SIZE)
2493}
@ SMSG_QUESTUPDATE_ADD_PVP_KILL
Definition Opcodes.h:1165

References ASSERT, FindQuestSlot(), Quest::GetPlayersSlain(), Quest::GetQuestId(), GetQuestSlotCounter(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, QUEST_PVP_KILL_SLOT, WorldSession::SendPacket(), SetQuestSlotCounter(), and SMSG_QUESTUPDATE_ADD_PVP_KILL.

Referenced by KilledPlayerCreditForQuest().

◆ SendRaidDifficulty()

void Player::SendRaidDifficulty ( bool  IsInGroup,
int32  forcedDifficulty = -1 
)
178{
179 uint8 val = 0x00000001;
181 data << uint32(forcedDifficulty == -1 ? GetRaidDifficulty() : forcedDifficulty);
182 data << uint32(val);
183 data << uint32(IsInGroup);
184 GetSession()->SendPacket(&data);
185}
@ MSG_SET_RAID_DIFFICULTY
Definition Opcodes.h:1289

References GetRaidDifficulty(), GetSession(), MSG_SET_RAID_DIFFICULTY, and WorldSession::SendPacket().

Referenced by Group::AddMember(), WorldSession::HandleSetRaidDifficultyOpcode(), SendInitialPacketsAfterAddToMap(), and Group::SetRaidDifficulty().

◆ SendRaidInfo()

void Player::SendRaidInfo ( )
6535{
6536 uint32 counter = 0;
6537
6539
6540 std::size_t p_counter = data.wpos();
6541 data << uint32(counter); // placeholder
6542
6543 time_t now = GameTime::GetGameTime().count();
6544
6545 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6546 {
6547 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6548 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6549 {
6550 if (itr->second.perm)
6551 {
6552 InstanceSave* save = itr->second.save;
6553 time_t resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
6554 data << uint32(save->GetMapId()); // map id
6555 data << uint32(save->GetDifficulty()); // difficulty
6556 data << ObjectGuid::Create<HighGuid::Instance>(save->GetInstanceId()); // instance id
6557 data << uint8(1); // expired = 0
6558 data << uint8(itr->second.extended ? 1 : 0);// extended = 1
6559 data << uint32(resetTime >= now ? resetTime - now : 0); // reset time
6560 ++counter;
6561 }
6562 }
6563 }
6564 data.put<uint32>(p_counter, counter);
6565 GetSession()->SendPacket(&data);
6566}
Difficulty GetDifficulty() const
Definition InstanceSaveMgr.h:63
@ SMSG_RAID_INSTANCE_INFO
Definition Opcodes.h:746

References InstanceSave::GetDifficulty(), InstanceSave::GetExtendedResetTime(), GameTime::GetGameTime(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), InstanceSave::GetResetTime(), GetSession(), MAX_DIFFICULTY, ByteBuffer::put(), WorldSession::SendPacket(), sInstanceSaveMgr, SMSG_RAID_INSTANCE_INFO, and ByteBuffer::wpos().

Referenced by WorldSession::HandleRequestRaidInfoOpcode().

◆ SendRefundInfo()

void Player::SendRefundInfo ( Item item)
private
15488{
15489 // This function call unsets ITEM_FLAGS_REFUNDABLE if played time is over 2 hours.
15490 item->UpdatePlayedTime(this);
15491
15492 if (!item->IsRefundable())
15493 {
15494 LOG_DEBUG("entities.player.items", "Item refund: item not refundable!");
15495 return;
15496 }
15497
15498 if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded
15499 {
15500 LOG_DEBUG("entities.player.items", "Item refund: item was traded!");
15501 item->SetNotRefundable(this);
15502 return;
15503 }
15504
15505 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost());
15506 if (!iece)
15507 {
15508 LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data.");
15509 return;
15510 }
15511
15512 WorldPacket data(SMSG_ITEM_REFUND_INFO_RESPONSE, 8 + 4 + 4 + 4 + 4 * 4 + 4 * 4 + 4 + 4);
15513 data << item->GetGUID(); // item guid
15514 data << uint32(item->GetPaidMoney()); // money cost
15515 data << uint32(iece->reqhonorpoints); // honor point cost
15516 data << uint32(iece->reqarenapoints); // arena point cost
15517 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
15518 {
15519 data << uint32(iece->reqitem[i]);
15520 data << uint32(iece->reqitemcount[i]);
15521 }
15522 data << uint32(0);
15523 data << uint32(GetTotalPlayedTime() - item->GetPlayedTime());
15524 GetSession()->SendPacket(&data);
15525}
uint32 GetTotalPlayedTime()
Definition Player.h:1208
@ SMSG_ITEM_REFUND_INFO_RESPONSE
Definition Opcodes.h:1232

References Object::GetGUID(), Object::GetGUID(), Item::GetPaidExtendedCost(), Item::GetPaidMoney(), Item::GetPlayedTime(), Item::GetRefundRecipient(), GetSession(), GetTotalPlayedTime(), Item::IsRefundable(), LOG_DEBUG, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, WorldSession::SendPacket(), Item::SetNotRefundable(), sItemExtendedCostStore, SMSG_ITEM_REFUND_INFO_RESPONSE, and Item::UpdatePlayedTime().

Referenced by WorldSession::HandleItemRefundInfoRequest(), and SwapItem().

◆ SendRemoveControlBar()

void Player::SendRemoveControlBar ( )
9741{
9743 data << uint64(0);
9744 GetSession()->SendPacket(&data);
9745}

References GetSession(), WorldSession::SendPacket(), and SMSG_PET_SPELLS.

Referenced by Unit::RemoveCharmedBy(), and Unit::SetMinion().

◆ SendResetFailedNotify()

void Player::SendResetFailedNotify ( uint32  mapid)
188{
190 data << uint32(mapid);
191 GetSession()->SendPacket(&data);
192}
@ SMSG_RESET_FAILED_NOTIFY
Definition Opcodes.h:948

References GetSession(), WorldSession::SendPacket(), and SMSG_RESET_FAILED_NOTIFY.

◆ SendResetInstanceFailed()

void Player::SendResetInstanceFailed ( uint32  reason,
uint32  MapId 
)
334{
335 /*reasons for instance reset failure:
336 // 0: There are players inside the instance.
337 // 1: There are players offline in your party.
338 // 2>: There are players in your party attempting to zone into an instance.
339 */
341 data << uint32(reason);
342 data << uint32(MapId);
343 GetSession()->SendPacket(&data);
344}
@ SMSG_INSTANCE_RESET_FAILED
Definition Opcodes.h:829

References GetSession(), WorldSession::SendPacket(), and SMSG_INSTANCE_RESET_FAILED.

Referenced by ResetInstances(), and Group::ResetInstances().

◆ SendResetInstanceSuccess()

void Player::SendResetInstanceSuccess ( uint32  MapId)
327{
329 data << uint32(MapId);
330 GetSession()->SendPacket(&data);
331}
@ SMSG_INSTANCE_RESET
Definition Opcodes.h:828

References GetSession(), WorldSession::SendPacket(), and SMSG_INSTANCE_RESET.

Referenced by ResetInstances(), and Group::ResetInstances().

◆ SendRespondInspectAchievements()

void Player::SendRespondInspectAchievements ( Player player) const
13883{
13885}
void SendRespondInspectAchievements(Player *player) const
Definition AchievementMgr.cpp:2384

References m_achievementMgr, and AchievementMgr::SendRespondInspectAchievements().

Referenced by WorldSession::HandleQueryInspectAchievements().

◆ SendSavedInstances()

void Player::SendSavedInstances ( )
6572{
6573 bool hasBeenSaved = false;
6574 WorldPacket data;
6575
6576 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6577 {
6578 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6579 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6580 {
6581 if (itr->second.perm) // only permanent binds are sent
6582 {
6583 hasBeenSaved = true;
6584 break;
6585 }
6586 }
6587 }
6588
6589 //Send opcode 811. true or false means, whether you have current raid/heroic instances
6591 data << uint32(hasBeenSaved);
6592 GetSession()->SendPacket(&data);
6593
6594 if (!hasBeenSaved)
6595 return;
6596
6597 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6598 {
6599 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6600 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6601 {
6602 if (itr->second.perm)
6603 {
6605 data << uint32(itr->second.save->GetMapId());
6606 GetSession()->SendPacket(&data);
6607 }
6608 }
6609 }
6610}
void Initialize(uint16 opcode, std::size_t newres=200)
Definition WorldPacket.h:68
@ SMSG_UPDATE_INSTANCE_OWNERSHIP
Definition Opcodes.h:841
@ SMSG_UPDATE_LAST_INSTANCE
Definition Opcodes.h:830

References Object::GetGUID(), GetSession(), WorldPacket::Initialize(), MAX_DIFFICULTY, WorldSession::SendPacket(), sInstanceSaveMgr, SMSG_UPDATE_INSTANCE_OWNERSHIP, and SMSG_UPDATE_LAST_INSTANCE.

Referenced by TeleportTo().

◆ SendSellError()

void Player::SendSellError ( SellResult  msg,
Creature creature,
ObjectGuid  guid,
uint32  param 
)
4077{
4078 LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM");
4079 WorldPacket data(SMSG_SELL_ITEM, (8 + 8 + (param ? 4 : 0) + 1)); // last check 2.0.10
4080 data << (creature ? creature->GetGUID() : ObjectGuid::Empty);
4081 data << guid;
4082 if (param > 0)
4083 data << uint32(param);
4084 data << uint8(msg);
4085 GetSession()->SendPacket(&data);
4086}
@ SMSG_SELL_ITEM
Definition Opcodes.h:447

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_SELL_ITEM.

Referenced by WorldSession::HandleBuybackItem(), debug_commandscript::HandleDebugSendSellErrorCommand(), WorldSession::HandleSellItemOpcode(), and WorldSession::SendListInventory().

◆ SendSystemMessage()

void Player::SendSystemMessage ( std::string_view  msg,
bool  escapeCharacters = false 
)
16326{
16327 ChatHandler(GetSession()).SendSysMessage(msg, escapeCharacters);
16328}

References GetSession(), and ChatHandler::SendSysMessage().

◆ SendTalentsInfoData()

◆ SendTalentWipeConfirm()

void Player::SendTalentWipeConfirm ( ObjectGuid  guid)
8909{
8910 WorldPacket data(MSG_TALENT_WIPE_CONFIRM, (8 + 4));
8911 data << guid;
8912 uint32 cost = sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost();
8913 data << cost;
8914 GetSession()->SendPacket(&data);
8915}
@ MSG_TALENT_WIPE_CONFIRM
Definition Opcodes.h:712

References CONFIG_NO_RESET_TALENT_COST, GetSession(), MSG_TALENT_WIPE_CONFIRM, resetTalentsCost(), WorldSession::SendPacket(), and sWorld.

Referenced by Spell::EffectUntrainTalents(), and OnGossipSelect().

◆ SendTaxiNodeStatusMultiple()

void Player::SendTaxiNodeStatusMultiple ( )
10496{
10497 DoForAllVisibleWorldObjects([this](WorldObject* worldObject)
10498 {
10499 Creature* creature = worldObject->ToCreature();
10500 if (!creature || creature->IsHostileTo(this))
10501 return;
10502
10503 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_FLIGHTMASTER))
10504 return;
10505
10506 uint32 nearestNode = sObjectMgr->GetNearestTaxiNode(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetMapId(), GetTeamId());
10507 if (!nearestNode)
10508 return;
10509
10511 data << creature->GetGUID();
10512 data << uint8(m_taxi.IsTaximaskNodeKnown(nearestNode) ? 1 : 0);
10513 SendDirectMessage(&data);
10514 });
10515}
bool IsTaximaskNodeKnown(uint32 nodeidx) const
Definition PlayerTaxi.h:35
@ SMSG_TAXINODE_STATUS
Definition Opcodes.h:457

References WorldObject::DoForAllVisibleWorldObjects(), Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTeamId(), Unit::HasNpcFlag(), Unit::IsHostileTo(), PlayerTaxi::IsTaximaskNodeKnown(), m_taxi, SendDirectMessage(), SMSG_TAXINODE_STATUS, sObjectMgr, Object::ToCreature(), and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendTeleportAckPacket()

void Player::SendTeleportAckPacket ( )
1337{
1339 data << GetPackGUID();
1340 data << uint32(0); // this value increments every time
1341 BuildMovementPacket(&data);
1342 GetSession()->SendPacket(&data);
1343}
void BuildMovementPacket(ByteBuffer *data) const
Definition Unit.cpp:19721
@ MSG_MOVE_TELEPORT_ACK
Definition Opcodes.h:229

References Unit::BuildMovementPacket(), Object::GetPackGUID(), GetSession(), MSG_MOVE_TELEPORT_ACK, and WorldSession::SendPacket().

Referenced by TeleportTo().

◆ SendTransferAborted()

void Player::SendTransferAborted ( uint32  mapid,
TransferAbortReason  reason,
uint8  arg = 0 
)
11687{
11689 data << uint32(mapid);
11690 data << uint8(reason); // transfer abort reason
11691 switch (reason)
11692 {
11696 // these are the ONLY cases that have an extra argument in the packet!!!
11697 data << uint8(arg);
11698 break;
11699 default:
11700 break;
11701 }
11702 GetSession()->SendPacket(&data);
11703}
@ TRANSFER_ABORT_UNIQUE_MESSAGE
Definition Player.h:798
@ TRANSFER_ABORT_INSUF_EXPAN_LVL
Definition Player.h:796
@ SMSG_TRANSFER_ABORTED
Definition Opcodes.h:94

References GetSession(), WorldSession::SendPacket(), SMSG_TRANSFER_ABORTED, TRANSFER_ABORT_DIFFICULTY, TRANSFER_ABORT_INSUF_EXPAN_LVL, and TRANSFER_ABORT_UNIQUE_MESSAGE.

Referenced by InstanceMap::CannotEnter(), MapMgr::PlayerCannotEnter(), Satisfy(), and TeleportTo().

◆ SendUpdateToOutOfRangeGroupMembers()

void Player::SendUpdateToOutOfRangeGroupMembers ( )
11674{
11676 return;
11677 if (Group* group = GetGroup())
11678 group->UpdatePlayerOutOfRange(this);
11679
11682 if (Pet* pet = GetPet())
11683 pet->ResetAuraUpdateMaskForRaid();
11684}
@ GROUP_UPDATE_FLAG_NONE
Definition Group.h:99

References GetGroup(), GetPet(), GROUP_UPDATE_FLAG_NONE, m_auraRaidUpdateMask, and m_groupUpdateMask.

Referenced by Update().

◆ SendUpdateWorldState()

void Player::SendUpdateWorldState ( uint32  variable,
uint32  value 
) const
2246{
2248 worldstate.VariableID = variable;
2249 worldstate.Value = value;
2250 SendDirectMessage(worldstate.Write());
2251}
Definition WorldStatePackets.h:50
int32 Value
Definition WorldStatePackets.h:57
WorldPacket const * Write() override
Definition WorldStatePackets.cpp:40
int32 VariableID
Definition WorldStatePackets.h:56

References SendDirectMessage(), WorldPackets::WorldState::UpdateWorldState::Value, WorldPackets::WorldState::UpdateWorldState::VariableID, and WorldPackets::WorldState::UpdateWorldState::Write().

Referenced by debug_commandscript::HandleDebugUpdateWorldStateCommand(), BfCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::HandlePlayerEnter(), OPvPCapturePointEP_EWT::HandlePlayerEnter(), OPvPCapturePointEP_NPT::HandlePlayerEnter(), OPvPCapturePointEP_CGT::HandlePlayerEnter(), OPvPCapturePointEP_PWT::HandlePlayerEnter(), OPvPCapturePointGH::HandlePlayerEnter(), OPvPCapturePointHP::HandlePlayerEnter(), OPvPCapturePointNA::HandlePlayerEnter(), OPvPCapturePointTF::HandlePlayerEnter(), OPvPCapturePointZM_Beacon::HandlePlayerEnter(), BfCapturePoint::HandlePlayerLeave(), OPvPCapturePoint::HandlePlayerLeave(), OPvPCapturePointEP_EWT::HandlePlayerLeave(), OPvPCapturePointEP_NPT::HandlePlayerLeave(), OPvPCapturePointEP_CGT::HandlePlayerLeave(), OPvPCapturePointEP_PWT::HandlePlayerLeave(), OPvPCapturePointGH::HandlePlayerLeave(), OPvPCapturePointHP::HandlePlayerLeave(), OPvPCapturePointNA::HandlePlayerLeave(), OPvPCapturePointTF::HandlePlayerLeave(), OPvPCapturePointZM_Beacon::HandlePlayerLeave(), npc_wg_queue::OnGossipHello(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerAreaUpdate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnPlayerEnter(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnPlayerEnter(), instance_oculus::instance_oculus_InstanceMapScript::OnPlayerEnter(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::OnPlayerEnter(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), SendBGWeekendWorldStates(), OutdoorPvPEP::SendRemoveWorldStates(), OutdoorPvPGH::SendRemoveWorldStates(), OutdoorPvPHP::SendRemoveWorldStates(), OutdoorPvPNA::SendRemoveWorldStates(), OutdoorPvPSI::SendRemoveWorldStates(), OutdoorPvPTF::SendRemoveWorldStates(), OutdoorPvPZM::SendRemoveWorldStates(), and GameEventMgr::SendWorldStateUpdate().

◆ SetAcceptWhispers()

void Player::SetAcceptWhispers ( bool  on)
inline

◆ SetActiveSpec()

void Player::SetActiveSpec ( uint8  spec)
inline
1756{ m_activeSpec = spec; }

References m_activeSpec.

Referenced by ActivateSpec().

◆ SetAmmo()

void Player::SetAmmo ( uint32  item)
2493{
2494 if (!item)
2495 return;
2496
2497 // already set
2498 if (GetUInt32Value(PLAYER_AMMO_ID) == item)
2499 return;
2500
2501 // check ammo
2502 InventoryResult msg = CanUseAmmo(item);
2503 if (msg != EQUIP_ERR_OK)
2504 {
2505 SendEquipError(msg, nullptr, nullptr, item);
2506 return;
2507 }
2508
2510
2512}

References _ApplyAmmoBonuses(), CanUseAmmo(), EQUIP_ERR_OK, Object::GetUInt32Value(), PLAYER_AMMO_ID, SendEquipError(), and Unit::SetUInt32Value().

Referenced by Create(), and WorldSession::HandleSetAmmoOpcode().

◆ SetArenaPoints()

void Player::SetArenaPoints ( uint32  value)
6296{
6297 if (value > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
6298 value = sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS);
6300 if (value)
6302}
@ ITEM_ARENA_POINTS_ID
Definition Player.h:968
@ CONFIG_MAX_ARENA_POINTS
Definition WorldConfig.h:195

References AddKnownCurrency(), CONFIG_MAX_ARENA_POINTS, ITEM_ARENA_POINTS_ID, PLAYER_FIELD_ARENA_CURRENCY, Unit::SetUInt32Value(), and sWorld.

Referenced by Create(), LoadFromDB(), and ModifyArenaPoints().

◆ SetArenaTeamIdInvited()

void Player::SetArenaTeamIdInvited ( uint32  ArenaTeamId)
inline

◆ SetArenaTeamInfoField()

void Player::SetArenaTeamInfoField ( uint8  slot,
ArenaTeamInfoType  type,
uint32  value 
)

◆ SetAtLoginFlag()

void Player::SetAtLoginFlag ( AtLoginFlags  f)
inline

◆ SetAuraUpdateMaskForRaid()

void Player::SetAuraUpdateMaskForRaid ( uint8  slot)
inline
2493{ m_auraRaidUpdateMask |= (uint64(1) << slot); }

References m_auraRaidUpdateMask.

◆ SetBankBagSlotCount()

void Player::SetBankBagSlotCount ( uint8  count)
inline

◆ SetBaseModValue()

void Player::SetBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType,
float  value 
)
inline
2210{ m_auraBaseMod[modGroup][modType] = value; }

References m_auraBaseMod.

Referenced by UpdateAllCritPercentages().

◆ SetBaseRune()

void Player::SetBaseRune ( uint8  index,
RuneType  baseRune 
)
inline
2531{ m_runes->runes[index].BaseRune = baseRune; }

References RuneInfo::BaseRune, m_runes, and Runes::runes.

Referenced by InitRunes().

◆ SetBattlegroundId()

◆ SetBattlegroundOrBattlefieldRaid()

void Player::SetBattlegroundOrBattlefieldRaid ( Group group,
int8  subgroup = -1 
)
13051{
13052 //we must move references from m_group to m_originalGroup
13053 if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup()))
13054 {
13055 LOG_INFO("misc", "Player::SetBattlegroundOrBattlefieldRaid - current group is {} group!", (GetGroup()->isBGGroup() ? "BG" : "BF"));
13056 //ABORT(); // pussywizard: origanal group can never be bf/bg group
13057 }
13058
13060
13061 m_group.unlink();
13062 m_group.link(group, this);
13063 m_group.setSubGroup((uint8)subgroup);
13064}
uint8 GetSubGroup() const
Definition Player.h:2489

References GetGroup(), GetSubGroup(), Reference< TO, FROM >::link(), LOG_INFO, m_group, SetOriginalGroup(), GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::AddMember(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), and Battleground::AddOrSetPlayerToCorrectBgGroup().

◆ SetBGData()

void Player::SetBGData ( BGData bgdata)
inline
2278{ m_bgData = bgdata; }

References m_bgData.

◆ SetBindPoint()

void Player::SetBindPoint ( ObjectGuid  guid)
8902{
8904 data << guid;
8905 GetSession()->SendPacket(&data);
8906}
@ SMSG_BINDER_CONFIRM
Definition Opcodes.h:777

References GetSession(), WorldSession::SendPacket(), and SMSG_BINDER_CONFIRM.

Referenced by npc_innkeeper::OnGossipSelect(), and OnGossipSelect().

◆ SetBonusTalentCount()

void Player::SetBonusTalentCount ( uint32  count)
inline
1747{ m_extraBonusTalentCount = count; };

References m_extraBonusTalentCount.

◆ SetCanBlock()

void Player::SetCanBlock ( bool  value)
13101{
13102 if (m_canBlock == value)
13103 return;
13104
13105 m_canBlock = value;
13107}
void UpdateBlockPercentage()
Definition StatSystem.cpp:633

References m_canBlock, and UpdateBlockPercentage().

Referenced by Spell::EffectBlock().

◆ SetCanFly()

bool Player::SetCanFly ( bool  enable,
bool  packetOnly = false 
)
overridevirtual

Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().

Doesn't inform the client.

movement counter

Reimplemented from Unit.

15888{
15889 sScriptMgr->AnticheatSetCanFlybyServer(this, apply);
15890
15891 if (!packetOnly && !Unit::SetCanFly(apply))
15892 return false;
15893
15894 if (!apply)
15896
15898 data << GetPackGUID();
15899 data << uint32(0);
15900 SendDirectMessage(&data);
15901
15903 data << GetPackGUID();
15904 BuildMovementPacket(&data);
15905 SendMessageToSet(&data, false);
15906 return true;
15907}
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:20466
@ MSG_MOVE_UPDATE_CAN_FLY
Definition Opcodes.h:971
@ SMSG_MOVE_SET_CAN_FLY
Definition Opcodes.h:865
@ SMSG_MOVE_UNSET_CAN_FLY
Definition Opcodes.h:866

References Unit::BuildMovementPacket(), GameTime::GetGameTime(), Object::GetPackGUID(), Position::GetPositionZ(), WorldPacket::Initialize(), MSG_MOVE_UPDATE_CAN_FLY, SendDirectMessage(), SendMessageToSet(), Unit::SetCanFly(), SetFallInformation(), SMSG_MOVE_SET_CAN_FLY, SMSG_MOVE_UNSET_CAN_FLY, and sScriptMgr.

Referenced by Unit::KnockbackFrom().

◆ SetCanKnockback()

void Player::SetCanKnockback ( bool  value)
inline
2517{ m_canKnockback = value; }

References m_canKnockback.

Referenced by Unit::KnockbackFrom().

◆ SetCanParry()

void Player::SetCanParry ( bool  value)
13092{
13093 if (m_canParry == value)
13094 return;
13095
13096 m_canParry = value;
13098}
void UpdateParryPercentage()
Definition StatSystem.cpp:752

References m_canParry, and UpdateParryPercentage().

Referenced by Spell::EffectParry(), and AuraEffect::HandleAuraModParryPercent().

◆ SetCanTeleport()

◆ SetCanTitanGrip()

void Player::SetCanTitanGrip ( bool  value)
13110{
13111 m_canTitanGrip = value;
13112}

References m_canTitanGrip.

Referenced by ActivateSpec(), Spell::EffectTitanGrip(), and resetTalents().

◆ SetChampioningFaction()

void Player::SetChampioningFaction ( uint32  faction)
inline
2568{ m_ChampioningFaction = faction; }

References m_ChampioningFaction.

Referenced by AuraEffect::HandleAuraDummy().

◆ setCinematic()

void Player::setCinematic ( uint8  cine)
inline
1849 {
1850 m_cinematic = cine;
1851 }

References m_cinematic.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ SetClientControl()

void Player::SetClientControl ( Unit target,
bool  allowMove,
bool  packetOnly = false 
)
12822{
12824 data << target->GetPackGUID();
12825 data << uint8((allowMove && !target->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED)) ? 1 : 0);
12826 GetSession()->SendPacket(&data);
12827
12828 // We want to set the packet only
12829 if (packetOnly)
12830 return;
12831
12832 if (this != target)
12833 SetViewpoint(target, allowMove);
12834
12835 if (allowMove)
12836 SetMover(target);
12837
12838 // Xinef: disable moving if target has disable move flag
12839 if (!target->IsCreature())
12840 return;
12841
12842 if (allowMove && target->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
12843 {
12845 target->SetControlled(true, UNIT_STATE_ROOT);
12846 }
12847 else if (!allowMove && target->HasUnitState(UNIT_STATE_ROOT) && !target->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
12848 {
12850 {
12851 // Xinef: restore original orientation, important for shooting vehicles!
12853 target->SetOrientation(pos.GetOrientation());
12854 target->SetFacingTo(pos.GetOrientation());
12855 target->DisableSpline();
12856 }
12857 else
12858 target->SetControlled(false, UNIT_STATE_ROOT);
12859 }
12860}
@ UNIT_MASK_ACCESSORY
Definition UnitDefines.h:165
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:181
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:177
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:342
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:347
bool IsMOTransport() const
Definition ObjectGuid.h:175
void SetFacingTo(float ori)
Definition Unit.cpp:20368
void DisableSpline()
Definition Unit.cpp:637
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18122
ObjectGuid GetTransGUID() const override
Definition Unit.cpp:18844
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:696
@ SMSG_CLIENT_CONTROL_UPDATE
Definition Opcodes.h:375
void SetOrientation(float orientation)
Definition Position.h:116

References Unit::ClearUnitState(), Unit::DisableSpline(), Creature::GetHomePosition(), Position::GetOrientation(), Object::GetPackGUID(), GetSession(), Unit::GetTransGUID(), Creature::GetTransportHomePosition(), Unit::HasUnitFlag(), Unit::HasUnitMovementFlag(), Unit::HasUnitState(), Unit::HasUnitTypeMask(), Object::IsCreature(), ObjectGuid::IsMOTransport(), MOVEMENTFLAG_ONTRANSPORT, WorldSession::SendPacket(), Unit::SetControlled(), Unit::SetFacingTo(), SetMover(), Position::SetOrientation(), SetViewpoint(), PackedGuid::size(), SMSG_CLIENT_CONTROL_UPDATE, Object::ToCreature(), UNIT_FLAG_DISABLE_MOVE, UNIT_MASK_ACCESSORY, UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, and UNIT_STATE_ROOT.

Referenced by Battleground::BlockMovement(), WorldSession::HandleMoveTeleportAck(), npc_pilgrims_bounty_chair::PassengerBoarded(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), Unit::SetConfused(), and Unit::SetFeared().

◆ SetCommandStatusOff()

◆ SetCommandStatusOn()

◆ SetCommentator()

void Player::SetCommentator ( bool  on)
inline

◆ SetContestedPvPTimer()

void Player::SetContestedPvPTimer ( uint32  newTime)
inline
1882{m_contestedPvPTimer = newTime;}

References m_contestedPvPTimer.

Referenced by Unit::SetContestedPvP().

◆ SetCreationTime()

void Player::SetCreationTime ( Seconds  creationTime)
inline
2555{ m_creationTime = creationTime; }

References m_creationTime.

Referenced by LoadFromDB().

◆ SetCurrentRune()

void Player::SetCurrentRune ( uint8  index,
RuneType  currentRune 
)
inline
2532{ m_runes->runes[index].CurrentRune = currentRune; }

References RuneInfo::CurrentRune, m_runes, and Runes::runes.

Referenced by ConvertRune(), and InitRunes().

◆ SetCurrentTitle()

void Player::SetCurrentTitle ( CharTitlesEntry const *  title,
bool  clear = false 
)
inline
2561{ SetUInt32Value(PLAYER_CHOSEN_TITLE, clear ? 0 : title->bit_index); };

References CharTitlesEntry::bit_index, PLAYER_CHOSEN_TITLE, and Unit::SetUInt32Value().

Referenced by SetTitle().

◆ SetDailyQuestStatus()

void Player::SetDailyQuestStatus ( uint32  quest_id)
12060{
12061 if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(quest_id))
12062 {
12063 if (!qQuest->IsDFQuest())
12064 {
12065 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12066 {
12067 if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
12068 {
12069 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
12070 m_lastDailyQuestTime = GameTime::GetGameTime().count(); // last daily quest time
12071 m_DailyQuestChanged = true;
12072 break;
12073 }
12074 }
12075 }
12076 else
12077 {
12078 m_DFQuests.insert(quest_id);
12080 m_DailyQuestChanged = true;
12081 }
12082 }
12083}

References GameTime::GetGameTime(), Object::GetUInt32Value(), m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, Unit::SetUInt32Value(), and sObjectMgr.

Referenced by RewardQuest().

◆ setDeathState()

void Player::setDeathState ( DeathState  s,
bool  despawn = false 
)
overridevirtual

Reimplemented from Unit.

1025{
1026 uint32 ressSpellId = 0;
1027
1028 bool cur = IsAlive();
1029
1030 if (s == DeathState::JustDied)
1031 {
1032 if (!cur)
1033 {
1034 LOG_ERROR("entities.player", "setDeathState: attempt to kill a dead player {} ({})", GetName(), GetGUID().ToString());
1035 return;
1036 }
1037
1038 // clear all pending spell cast requests when dying
1039 SpellQueue.clear();
1040
1041 // drunken state is cleared on death
1042 SetDrunkValue(0);
1043 // lost combo points at any target (targeted combo points clear in Unit::setDeathState)
1045
1047
1048 //FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DeathState::Dead) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
1049 RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
1050
1051 // save value before aura remove in Unit::setDeathState
1053
1054 // xinef: disable passive area auras!
1056
1057 // passive spell
1058 if (!ressSpellId)
1059 ressSpellId = GetResurrectionSpellId();
1063
1064 // Xinef: reset all death criterias
1066 }
1067 // xinef: enable passive area auras!
1068 else if (s == DeathState::Alive)
1070
1072
1075
1076 // restore resurrection spell id for player after aura remove
1077 if (s == DeathState::JustDied && cur && ressSpellId)
1079
1080 if (IsAlive() && !cur)
1081 //clear aura case after resurrection by another way (spells will be applied before next death)
1083}
@ ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH
Definition DBCEnums.h:88
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP
Definition DBCEnums.h:133
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH
Definition DBCEnums.h:134
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON
Definition DBCEnums.h:135
@ PLAYER_SELF_RES_SPELL
Definition UpdateFields.h:370
uint32 GetResurrectionSpellId()
Definition Player.cpp:12581
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
Definition Player.cpp:13902
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:14645

References ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH, ACHIEVEMENT_CRITERIA_TYPE_DEATH, ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, Unit::AddUnitState(), Alive, Unit::ClearComboPoints(), clearResurrectRequestData(), Unit::ClearUnitState(), WorldObject::FindMap(), Object::GetGUID(), WorldObject::GetName(), GetResurrectionSpellId(), Object::GetUInt32Value(), Unit::IsAlive(), JustDied, LOG_ERROR, NeedSendSpectatorData(), PET_SAVE_NOT_IN_SLOT, PLAYER_SELF_RES_SPELL, RemovePet(), ResetAchievementCriteria(), ArenaSpectator::SendCommand_UInt32Value(), Unit::setDeathState(), SetDrunkValue(), Unit::SetUInt32Value(), SpellQueue, Position::ToString(), UNIT_STATE_ISOLATED, and UpdateAchievementCriteria().

Referenced by KillPlayer(), and ResurrectPlayer().

◆ SetDeveloper()

void Player::SetDeveloper ( bool  on)
inline

◆ SetDisableGravity()

bool Player::SetDisableGravity ( bool  disable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

movement counter

Reimplemented from Unit.

15871{
15872 if (!packetOnly && !Unit::SetDisableGravity(disable))
15873 return false;
15874
15876 data << GetPackGUID();
15877 data << uint32(0);
15878 SendDirectMessage(&data);
15879
15881 data << GetPackGUID();
15882 BuildMovementPacket(&data);
15883 SendMessageToSet(&data, false);
15884 return true;
15885}
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition Unit.cpp:20423
@ SMSG_MOVE_GRAVITY_DISABLE
Definition Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition Opcodes.h:1262
@ MSG_MOVE_GRAVITY_CHNG
Definition Opcodes.h:1264

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_GRAVITY_CHNG, SendDirectMessage(), SendMessageToSet(), Unit::SetDisableGravity(), SMSG_MOVE_GRAVITY_DISABLE, and SMSG_MOVE_GRAVITY_ENABLE.

Referenced by npc_vortex_ride::npc_vortex_rideAI::PassengerBoarded().

◆ SetDivider()

◆ SetDrunkValue()

void Player::SetDrunkValue ( uint8  newDrunkValue,
uint32  itemId = 0 
)
982{
983 newDrunkValue = std::min<uint8>(newDrunkValue, 100);
984 if (newDrunkValue == GetDrunkValue())
985 return;
986
988 uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
989
992
993 m_drunkTimer = 0; // reset sobering timer
994
995 if (newDrunkenState == oldDrunkenState)
996 return;
997
999 data.Guid = GetGUID();
1000 data.Threshold = newDrunkenState;
1001 data.ItemID = itemId;
1002
1003 SendMessageToSet(data.Write(), true);
1004}
@ PLAYER_BYTES_3_OFFSET_INEBRIATION
Definition Player.h:535
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:1006
static DrunkenState GetDrunkenstateByValue(uint8 value)
Definition Player.cpp:970
WorldPacket const * Write() override
Definition MiscPackets.cpp:113
ObjectGuid Guid
Definition MiscPackets.h:175
uint32 Threshold
Definition MiscPackets.h:176
uint32 ItemID
Definition MiscPackets.h:177

References GetDrunkenstateByValue(), GetDrunkValue(), Object::GetGUID(), WorldPackets::Misc::CrossedInebriationThreshold::Guid, WorldPackets::Misc::CrossedInebriationThreshold::ItemID, m_drunkTimer, PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION, SendMessageToSet(), Object::SetByteValue(), WorldPackets::Misc::CrossedInebriationThreshold::Threshold, UpdateInvisibilityDrunkDetect(), and WorldPackets::Misc::CrossedInebriationThreshold::Write().

Referenced by Spell::EffectInebriate(), HandleSobering(), LoadFromDB(), and setDeathState().

◆ SetDungeonDifficulty()

void Player::SetDungeonDifficulty ( Difficulty  dungeon_difficulty)
inline

◆ SetEntryPoint()

void Player::SetEntryPoint ( )
11263{
11266
11267 if (!m_taxi.empty())
11268 {
11271
11274 }
11275 else
11276 {
11277 if (IsMounted())
11278 {
11280 if (!auras.empty())
11281 m_entryPointData.mountSpell = (*auras.begin())->GetId();
11282 }
11283 else
11285
11286 if (GetMap()->IsDungeon())
11287 {
11288 if (const GraveyardStruct* entry = sGraveyard->GetClosestGraveyard(this, GetTeamId()))
11289 m_entryPointData.joinPos = WorldLocation(entry->Map, entry->x, entry->y, entry->z, 0.0f);
11290 }
11291 else if (!GetMap()->IsBattlegroundOrArena())
11293 }
11294
11297}
bool IsDungeon() const
Definition Map.h:290
bool IsBattlegroundOrArena() const
Definition Map.h:298
bool empty() const
Definition PlayerTaxi.h:76
uint32 GetTaxiDestination() const
Definition PlayerTaxi.h:64
uint32 m_mapId
Definition Position.h:323

References EntryPointData::ClearTaxiPath(), PlayerTaxi::empty(), Unit::GetAuraEffectsByType(), WorldObject::GetMap(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), PlayerTaxi::GetTaxiDestination(), PlayerTaxi::GetTaxiSource(), GetTeamId(), Map::IsBattlegroundOrArena(), Map::IsDungeon(), Unit::IsMounted(), EntryPointData::joinPos, m_entryPointData, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, WorldLocation::m_mapId, m_taxi, MAPID_INVALID, EntryPointData::mountSpell, sGraveyard, SPELL_AURA_MOUNTED, and EntryPointData::taxiPath.

Referenced by misc_commandscript::HandleAppearCommand(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), and lfg::LFGMgr::TeleportPlayer().

◆ SetEquipmentSet()

void Player::SetEquipmentSet ( uint32  index,
EquipmentSet  eqset 
)
14475{
14476 if (eqset.Guid != 0)
14477 {
14478 bool found = false;
14479
14480 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14481 {
14482 if ((itr->second.Guid == eqset.Guid) && (itr->first == index))
14483 {
14484 found = true;
14485 break;
14486 }
14487 }
14488
14489 if (!found) // something wrong...
14490 {
14491 LOG_ERROR("entities.player", "Player {} tried to save equipment set {} (index {}), but that equipment set not found!", GetName(), eqset.Guid, index);
14492 return;
14493 }
14494 }
14495
14496 EquipmentSet& eqslot = m_EquipmentSets[index];
14497
14498 EquipmentSetUpdateState old_state = eqslot.state;
14499
14500 eqslot = eqset;
14501
14502 if (eqset.Guid == 0)
14503 {
14504 eqslot.Guid = sObjectMgr->GenerateEquipmentSetGuid();
14505
14507 data << uint32(index);
14508 data.appendPackGUID(eqslot.Guid);
14509 GetSession()->SendPacket(&data);
14510 }
14511
14513}
EquipmentSetUpdateState
Definition Player.h:748
@ SMSG_EQUIPMENT_SET_SAVED
Definition Opcodes.h:341

References ByteBuffer::appendPackGUID(), EQUIPMENT_SET_CHANGED, EQUIPMENT_SET_NEW, WorldObject::GetName(), GetSession(), EquipmentSet::Guid, LOG_ERROR, m_EquipmentSets, WorldSession::SendPacket(), SMSG_EQUIPMENT_SET_SAVED, sObjectMgr, and EquipmentSet::state.

Referenced by WorldSession::HandleEquipmentSetSave().

◆ SetFactionForRace()

void Player::SetFactionForRace ( uint8  race)
5883{
5884 m_team = TeamIdForRace(race);
5885
5886 sScriptMgr->OnPlayerUpdateFaction(this);
5887
5888 if (GetTeamId(true) != GetTeamId())
5889 return;
5890
5891 ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
5892 SetFaction(rEntry ? rEntry->FactionID : 0);
5893}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
void SetFaction(uint32 faction)
Definition Unit.cpp:10117
Definition DBCStructure.h:679
uint32 FactionID
Definition DBCStructure.h:682

References ChrRacesEntry::FactionID, GetTeamId(), m_team, sChrRacesStore, Unit::SetFaction(), sScriptMgr, and TeamIdForRace().

Referenced by Create(), reset_commandscript::HandleResetStatsOrLevelHelper(), LoadFromDB(), InstanceScript::OnPlayerLeave(), Unit::RestoreFaction(), and SetGameMaster().

◆ SetFallInformation()

◆ SetFarSightDistance()

void Player::SetFarSightDistance ( float  radius)
16238{
16239 _farSightDistance = radius;
16240}

References _farSightDistance.

Referenced by AuraEffect::HandleFarSight().

◆ SetFeatherFall()

bool Player::SetFeatherFall ( bool  apply,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

15952{
15953 // Xinef: moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15954 if (!packetOnly/* && !Unit::SetFeatherFall(apply)*/)
15955 {
15956 Unit::SetFeatherFall(apply);
15957 //return false;
15958 }
15959
15961 data << GetPackGUID();
15962 data << uint32(0);
15963 SendDirectMessage(&data);
15964
15966 data << GetPackGUID();
15967 BuildMovementPacket(&data);
15968 SendMessageToSet(&data, false);
15969 return true;
15970}
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition Unit.cpp:20510
@ SMSG_MOVE_FEATHER_FALL
Definition Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition Opcodes.h:273
@ MSG_MOVE_FEATHER_FALL
Definition Opcodes.h:718

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_FEATHER_FALL, SendDirectMessage(), SendMessageToSet(), Unit::SetFeatherFall(), SMSG_MOVE_FEATHER_FALL, and SMSG_MOVE_NORMAL_FALL.

◆ SetFreePrimaryProfessions()

void Player::SetFreePrimaryProfessions ( uint16  profs)
inline

◆ SetFreeTalentPoints()

void Player::SetFreeTalentPoints ( uint32  points)

◆ SetGameMaster()

void Player::SetGameMaster ( bool  on)
2220{
2221 if (on)
2222 {
2224 if (GetSession()->IsGMAccount())
2228
2229 if (Pet* pet = GetPet())
2230 {
2231 if (GetSession()->IsGMAccount())
2232 pet->SetFaction(FACTION_FRIENDLY);
2233 pet->getHostileRefMgr().setOnlineOfflineState(false);
2234 }
2236 {
2238 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
2239 }
2241
2244
2245 SetPhaseMask(uint32(PHASEMASK_ANYWHERE), false); // see and visible in all phases
2247 }
2248 else
2249 {
2250 // restore phase
2251 uint32 newPhase = GetPhaseByAuras();
2252
2253 if (!newPhase)
2254 newPhase = PHASEMASK_NORMAL;
2255
2256 SetPhaseMask(newPhase, false);
2257
2258 m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
2262
2263 if (Pet* pet = GetPet())
2264 {
2265 pet->SetFaction(GetFaction());
2266 pet->getHostileRefMgr().setOnlineOfflineState(true);
2267 }
2268
2269 // restore FFA PvP Server state
2270 if (sWorld->IsFFAPvPRealm())
2271 {
2273 {
2275 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
2276 }
2277 }
2278 // restore FFA PvP area state, remove not allowed for GM mounts
2280
2283 }
2284
2286}
@ SEC_PLAYER
Definition Common.h:57
@ PHASEMASK_ANYWHERE
Definition Object.h:63
@ SERVERSIDE_VISIBILITY_GM
Definition SharedDefines.h:1273
@ FACTION_FRIENDLY
Definition SharedDefines.h:201
@ UNIT_FLAG2_ALLOW_CHEAT_SPELLS
Definition UnitDefines.h:306
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:384
void ResetContestedPvP()
Definition Player.h:1883
void UpdateArea(uint32 newArea)
Definition PlayerUpdates.cpp:1215
uint32 GetFaction() const
Definition Unit.h:801
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:19137
void CombatStopWithPets(bool includingCast=false)
Definition Unit.cpp:10540
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:603
bool IsGMAccount(uint32 gmlevel)
Definition AccountMgr.cpp:317

References Unit::CombatStopWithPets(), FACTION_FRIENDLY, Unit::GetFaction(), Unit::getHostileRefMgr(), GetPet(), Unit::GetPhaseByAuras(), Unit::getRace(), GetSession(), Object::HasByteFlag(), m_areaUpdateId, m_ExtraFlags, WorldObject::m_serverSideVisibilityDetect, PHASEMASK_ANYWHERE, PHASEMASK_NORMAL, PLAYER_EXTRA_GM_ON, PLAYER_FLAGS_GM, Object::RemoveByteFlag(), RemovePlayerFlag(), Unit::RemoveUnitFlag2(), ResetContestedPvP(), SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, Object::SetByteFlag(), Unit::SetFaction(), SetFactionForRace(), HostileRefMgr::setOnlineOfflineState(), Unit::SetPhaseMask(), SetPlayerFlag(), Unit::SetUnitFlag2(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_FIELD_BYTES_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS, UpdateArea(), and UpdateObjectVisibility().

Referenced by gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), and LoadFromDB().

◆ SetGlyph()

void Player::SetGlyph ( uint8  slot,
uint32  glyph,
bool  save 
)
inline
1773 {
1774 m_Glyphs[m_activeSpec][slot] = glyph;
1776
1777 if (save)
1778 SetNeedToSaveGlyphs(true);
1779 }
@ PLAYER_FIELD_GLYPHS_1
Definition UpdateFields.h:389

References m_activeSpec, m_Glyphs, PLAYER_FIELD_GLYPHS_1, SetNeedToSaveGlyphs(), and Unit::SetUInt32Value().

Referenced by _LoadGlyphAuras(), ActivateSpec(), Spell::EffectApplyGlyph(), and WorldSession::HandleRemoveGlyph().

◆ SetGlyphSlot()

void Player::SetGlyphSlot ( uint8  slot,
uint32  slottype 
)
inline

◆ SetGMChat()

void Player::SetGMChat ( bool  on)
inline
1180{ if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }

References m_ExtraFlags, and PLAYER_EXTRA_GM_CHAT.

Referenced by LoadFromDB().

◆ SetGMSpectator()

void Player::SetGMSpectator ( bool  on)
inline
1182{ if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_SPECTATOR; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_SPECTATOR; }

References m_ExtraFlags, and PLAYER_EXTRA_GM_SPECTATOR.

Referenced by gm_commandscript::HandleGMSpectatorCommand().

◆ SetGMVisible()

void Player::SetGMVisible ( bool  on)
2289{
2290 const uint32 VISUAL_AURA = 37800;
2291
2292 if (on)
2293 {
2294 RemoveAurasDueToSpell(VISUAL_AURA);
2295 m_ExtraFlags &= ~PLAYER_EXTRA_GM_INVISIBLE;
2297
2300 }
2301 else
2302 {
2303 AddAura(VISUAL_AURA, this);
2306 }
2307}
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:602

References Unit::AddAura(), Unit::CombatStopWithPets(), Unit::getHostileRefMgr(), GetSession(), m_ExtraFlags, WorldObject::m_serverSideVisibility, PLAYER_EXTRA_GM_INVISIBLE, Unit::RemoveAurasDueToSpell(), SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, HostileRefMgr::setOnlineOfflineState(), and FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue().

Referenced by gm_commandscript::HandleGMVisibleCommand(), and LoadFromDB().

◆ SetGracePeriod()

void Player::SetGracePeriod ( uint8  index,
uint32  period 
)
inline

◆ SetGrantableLevels()

void Player::SetGrantableLevels ( uint8  val)
inline

◆ SetGroup()

void Player::SetGroup ( Group group,
int8  subgroup = -1 
)
11533{
11534 if (!group)
11535 m_group.unlink();
11536 else
11537 {
11538 // never use SetGroup without a subgroup unless you specify nullptr for group
11539 ASSERT(subgroup >= 0);
11540 m_group.link(group, this);
11541 m_group.setSubGroup((uint8)subgroup);
11542 }
11543
11545}

References ASSERT, Reference< TO, FROM >::link(), m_group, GroupReference::setSubGroup(), Reference< TO, FROM >::unlink(), and UpdateObjectVisibility().

Referenced by _LoadGroup(), Group::AddMember(), Group::Disband(), and Group::RemoveMember().

◆ SetGroupInvite()

void Player::SetGroupInvite ( Group group)
inline

◆ SetGroupUpdateFlag()

◆ SetGuildIdInvited()

void Player::SetGuildIdInvited ( uint32  GuildId)
inline

◆ SetHas310Flyer()

void Player::SetHas310Flyer ( bool  on)
inline
1189{ if (on) m_ExtraFlags |= PLAYER_EXTRA_HAS_310_FLYER; else m_ExtraFlags &= ~PLAYER_EXTRA_HAS_310_FLYER; }

References m_ExtraFlags, and PLAYER_EXTRA_HAS_310_FLYER.

Referenced by _addSpell(), and Has310Flyer().

◆ SetHasDelayedTeleport()

void Player::SetHasDelayedTeleport ( bool  setting)
inlineprivate
2969{ m_bHasDelayedTeleport = setting; }

References m_bHasDelayedTeleport.

Referenced by TeleportTo(), and Update().

◆ SetHomebind()

void Player::SetHomebind ( WorldLocation const &  loc,
uint32  areaId 
)
4904{
4905 loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
4906 m_homebindMapId = loc.GetMapId();
4907 m_homebindAreaId = areaId;
4908
4909 // update sql homebind
4911 stmt->SetData(0, m_homebindMapId);
4912 stmt->SetData(1, m_homebindAreaId);
4913 stmt->SetData (2, m_homebindX);
4914 stmt->SetData (3, m_homebindY);
4915 stmt->SetData (4, m_homebindZ);
4916 stmt->SetData(5, GetGUID().GetCounter());
4917 CharacterDatabase.Execute(stmt);
4918}
@ CHAR_UPD_PLAYER_HOMEBIND
Definition CharacterDatabase.h:243

References CHAR_UPD_PLAYER_HOMEBIND, CharacterDatabase, Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPosition(), m_homebindAreaId, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, and PreparedStatementBase::SetData().

Referenced by Spell::EffectBind().

◆ SetHonorPoints()

void Player::SetHonorPoints ( uint32  value)
6275{
6276 if (value > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
6277 {
6278 if (int32 copperPerPoint = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT))
6279 {
6280 // Only convert points on login, not when awarded honor points.
6281 if (isBeingLoaded())
6282 {
6283 int32 excessPoints = value - sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
6284 ModifyMoney(excessPoints * copperPerPoint);
6285 }
6286 }
6287
6288 value = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
6289 }
6291 if (value)
6293}
@ ITEM_HONOR_POINTS_ID
Definition Player.h:967
@ CONFIG_MAX_HONOR_POINTS
Definition WorldConfig.h:192
@ CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT
Definition WorldConfig.h:193

References AddKnownCurrency(), CONFIG_MAX_HONOR_POINTS, CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT, isBeingLoaded(), ITEM_HONOR_POINTS_ID, ModifyMoney(), PLAYER_FIELD_HONOR_CURRENCY, Unit::SetUInt32Value(), and sWorld.

Referenced by Create(), reset_commandscript::HandleResetHonorCommand(), LoadFromDB(), and ModifyHonorPoints().

◆ SetHover()

bool Player::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

movement counter

Reimplemented from Unit.

15910{
15911 // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15912 if (!packetOnly /* && !Unit::SetHover(apply)*/)
15913 {
15914 Unit::SetHover(apply);
15915 // return false;
15916 }
15917
15919 data << GetPackGUID();
15920 data << uint32(0);
15921 SendDirectMessage(&data);
15922
15923 data.Initialize(MSG_MOVE_HOVER, 64);
15924 data << GetPackGUID();
15925 BuildMovementPacket(&data);
15926 SendMessageToSet(&data, false);
15927 return true;
15928}
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition Unit.cpp:20532
@ MSG_MOVE_HOVER
Definition Opcodes.h:277
@ SMSG_MOVE_SET_HOVER
Definition Opcodes.h:274
@ SMSG_MOVE_UNSET_HOVER
Definition Opcodes.h:275

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_HOVER, SendDirectMessage(), SendMessageToSet(), Unit::SetHover(), SMSG_MOVE_SET_HOVER, and SMSG_MOVE_UNSET_HOVER.

◆ SetInArenaTeam()

void Player::SetInArenaTeam ( uint32  ArenaTeamId,
uint8  slot,
uint8  type 
)
inline
1921 {
1922 SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
1924 }

References ARENA_TEAM_ID, ARENA_TEAM_TYPE, and SetArenaTeamInfoField().

Referenced by ArenaTeam::AddMember().

◆ SetInGameTime()

void Player::SetInGameTime ( uint32  time)
inline

◆ SetInGuild()

void Player::SetInGuild ( uint32  GuildId)
inline

◆ SetInviteForBattlegroundQueueType()

void Player::SetInviteForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId,
uint32  instanceId 
)
12251{
12252 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12253 if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
12254 _BgBattlegroundQueueID[i].invitedToInstance = instanceId;
12255}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by BattlegroundQueue::InviteGroupToBG().

◆ SetInWater()

void Player::SetInWater ( bool  apply)
2177{
2178 if (m_isInWater == apply)
2179 return;
2180
2181 //define player in water by opcodes
2182 //move player's guid into HateOfflineList of those mobs
2183 //which can't swim and move guid back into ThreatList when
2184 //on surface.
2185 //TODO: exist also swimming mobs, and function must be symmetric to enter/leave water
2187
2188 // remove auras that need water/land
2190
2192
2193 if (InstanceScript* instance = GetInstanceScript())
2194 instance->OnPlayerInWaterStateUpdate(this, apply);
2195}
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition SpellDefines.h:50
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition SpellDefines.h:51
void updateThreatTables()
Definition HostileRefMgr.cpp:111

References AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, Unit::getHostileRefMgr(), WorldObject::GetInstanceScript(), m_isInWater, Unit::RemoveAurasWithInterruptFlags(), and HostileRefMgr::updateThreatTables().

Referenced by WorldSession::HandleMovementOpcodes().

◆ SetIsSpectator()

void Player::SetIsSpectator ( bool  on)
15324{
15325 if (on)
15326 {
15330 //SetFaction(1100);
15333 {
15335 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
15336 }
15338 SetDisplayId(23691);
15339 }
15340 else
15341 {
15343 if (IsSpectator())
15345 m_ExtraFlags &= ~PLAYER_EXTRA_SPECTATOR_ON;
15348
15349 if (!IsGameMaster())
15350 {
15351 //SetFactionForRace(getRace());
15352
15353 // restore FFA PvP Server state
15354 // Xinef: it will be removed if necessery in UpdateArea called in WorldPortOpcode
15355 if (sWorld->IsFFAPvPRealm())
15356 {
15358 {
15360 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
15361
15362 }
15363 }
15364 }
15365 }
15366}
#define SPECTATOR_SPELL_SPEED
Definition ArenaSpectator.h:39
void RestoreDisplayId()
Definition Unit.cpp:16849

References Unit::AddAura(), Unit::AddUnitState(), Unit::ClearUnitState(), Object::HasByteFlag(), IsGameMaster(), IsSpectator(), m_ExtraFlags, PLAYER_EXTRA_SPECTATOR_ON, Unit::RemoveAurasDueToSpell(), Object::RemoveByteFlag(), Unit::RemoveUnitFlag(), ResetContestedPvP(), Unit::RestoreDisplayId(), Object::SetByteFlag(), Unit::SetDisplayId(), Unit::SetUnitFlag(), SPECTATOR_SPELL_SPEED, sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, and UNIT_STATE_ISOLATED.

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetLastPetNumber()

void Player::SetLastPetNumber ( uint32  petnumber)
inline
2475{ m_lastpetnumber = petnumber; }

References m_lastpetnumber.

Referenced by Pet::LoadPetFromDB().

◆ SetLastPetSpell()

void Player::SetLastPetSpell ( uint32  petspell)
inline
2477{ m_oldpetspell = petspell; }

References m_oldpetspell.

Referenced by Pet::LoadPetFromDB(), and UnsummonPetTemporaryIfAny().

◆ SetLastPotionId()

void Player::SetLastPotionId ( uint32  item_id)
inline
1826{ m_lastPotionId = item_id; }

References m_lastPotionId.

Referenced by Spell::SendSpellCooldown(), and UpdatePotionCooldown().

◆ SetLastUsedRune()

void Player::SetLastUsedRune ( RuneType  type)
inline
2530{ m_runes->lastUsedRune = type; }

References Runes::lastUsedRune, and m_runes.

Referenced by Spell::TakeRunePower().

◆ SetLootGUID()

void Player::SetLootGUID ( ObjectGuid  guid)
inline
2012{ m_lootGuid = guid; }

References m_lootGuid.

Referenced by WorldSession::DoLootRelease(), and SendLoot().

◆ SetMap()

void Player::SetMap ( Map map)
overridevirtual

Reimplemented from WorldObject.

14644{
14645 Unit::SetMap(map);
14646 m_mapRef.link(map, this);
14647}
virtual void SetMap(Map *map)
Definition Object.cpp:2073

References Reference< TO, FROM >::link(), m_mapRef, and WorldObject::SetMap().

Referenced by Map::AddPlayerToMap(), Create(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleSetRaidDifficultyOpcode(), and LoadFromDB().

◆ SetMoney()

void Player::SetMoney ( uint32  value)
inline

◆ SetMonthlyQuestStatus()

void Player::SetMonthlyQuestStatus ( uint32  quest_id)
12118{
12119 m_monthlyquests.insert(quest_id);
12120 m_MonthlyQuestChanged = true;
12121}

References m_MonthlyQuestChanged, and m_monthlyquests.

Referenced by RewardQuest().

◆ SetMountBlockId()

void Player::SetMountBlockId ( uint32  mount)
inline

◆ SetMovement()

void Player::SetMovement ( PlayerMovementType  pType)
4426{
4427 WorldPacket data;
4428 switch (pType)
4429 {
4430 case MOVE_ROOT:
4431 data.Initialize(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4);
4432 break;
4433 case MOVE_UNROOT:
4434 data.Initialize(SMSG_FORCE_MOVE_UNROOT, GetPackGUID().size() + 4);
4435 break;
4436 case MOVE_WATER_WALK:
4437 data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size() + 4);
4438 break;
4439 case MOVE_LAND_WALK:
4440 data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4);
4441 break;
4442 default:
4443 LOG_ERROR("entities.player", "Player::SetMovement: Unsupported move type ({}), data not sent to client.", pType);
4444 return;
4445 }
4446 data << GetPackGUID();
4447 data << uint32(0);
4448 GetSession()->SendPacket(&data);
4449}
@ SMSG_MOVE_LAND_WALK
Definition Opcodes.h:253
@ SMSG_MOVE_WATER_WALK
Definition Opcodes.h:252
@ SMSG_FORCE_MOVE_UNROOT
Definition Opcodes.h:264

References Object::GetPackGUID(), GetSession(), WorldPacket::Initialize(), LOG_ERROR, MOVE_LAND_WALK, MOVE_ROOT, MOVE_UNROOT, MOVE_WATER_WALK, WorldSession::SendPacket(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_MOVE_LAND_WALK, and SMSG_MOVE_WATER_WALK.

Referenced by BuildPlayerRepop(), WorldSession::HandlePlayerLoginFromDB(), cheat_commandscript::HandleWaterWalkCheatCommand(), KillPlayer(), ResurrectPlayer(), and SendInitialPacketsAfterAddToMap().

◆ SetMover()

void Player::SetMover ( Unit target)
12863{
12864 if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this)
12865 {
12866 LOG_INFO("misc", "Player::SetMover (A1) - {}, {}, {}, {}, {}, {}, {}, {}", GetGUID().ToString(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0);
12867 LOG_INFO("misc", "Player::SetMover (A2) - {}, {}, {}, {}, {}, {}, {}, {}", target->GetGUID().ToString(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0);
12868 LOG_INFO("misc", "Player::SetMover (A3) - {}, {}, {}, {}, {}, {}, {}, {}", target->m_movedByPlayer->GetGUID().ToString(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap()->GetId(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0);
12869 }
12870 if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId()))
12871 {
12872 LOG_INFO("misc", "Player::SetMover (B1) - {}, {}, {}, {}, {}, {}, {}, {}", GetGUID().ToString(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0);
12873 LOG_INFO("misc", "Player::SetMover (B2) - {}, {}, {}, {}, {}, {}, {}, {}", target->GetGUID().ToString(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0);
12874 }
12875 m_mover->m_movedByPlayer = nullptr;
12876 if (m_mover->IsCreature())
12878
12879 m_mover = target;
12880 m_mover->m_movedByPlayer = this;
12881 if (m_mover->IsCreature())
12883}
void Initialize()
Definition MotionMaster.cpp:73
bool IsDuringRemoveFromWorld() const
Definition Unit.h:658

References WorldObject::FindMap(), Object::GetGUID(), Object::GetGUID(), Map::GetId(), WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), MotionMaster::Initialize(), Unit::isBeingLoaded(), isBeingLoaded(), IsBeingTeleported(), Object::IsCreature(), Unit::IsDuringRemoveFromWorld(), Object::IsInWorld(), LOG_INFO, Unit::m_movedByPlayer, m_mover, Object::ToPlayer(), ObjectGuid::ToString(), and Position::ToString().

Referenced by SendInitialPacketsBeforeAddToMap(), and SetClientControl().

◆ SetMustDelayTeleport()

void Player::SetMustDelayTeleport ( bool  setting)
inlineprivate
2967{ m_bMustDelayTeleport = setting; }

References m_bMustDelayTeleport.

Referenced by RewardQuest(), and Update().

◆ SetNeedToSaveGlyphs()

void Player::SetNeedToSaveGlyphs ( bool  val)
inline
2618{ m_NeedToSaveGlyphs = val; }

References m_NeedToSaveGlyphs.

Referenced by _SaveGlyphs(), and SetGlyph().

◆ SetNeedZoneUpdate()

void Player::SetNeedZoneUpdate ( bool  needUpdate)
inline
1873{ m_needZoneUpdate = needUpdate; }

References m_needZoneUpdate.

Referenced by WorldSession::HandleZoneUpdateOpcode().

◆ SetObjectScale()

void Player::SetObjectScale ( float  scale)
inlineoverridevirtual

Reimplemented from Object.

1098 {
1099 Unit::SetObjectScale(scale);
1102 }
#define DEFAULT_WORLD_OBJECT_SIZE
Definition ObjectDefines.h:45
#define DEFAULT_COMBAT_REACH
Definition ObjectDefines.h:46
@ UNIT_FIELD_COMBATREACH
Definition UpdateFields.h:123
@ UNIT_FIELD_BOUNDINGRADIUS
Definition UpdateFields.h:122
virtual void SetObjectScale(float scale)
Definition Object.h:120

References DEFAULT_COMBAT_REACH, DEFAULT_WORLD_OBJECT_SIZE, Object::SetFloatValue(), Object::SetObjectScale(), UNIT_FIELD_BOUNDINGRADIUS, and UNIT_FIELD_COMBATREACH.

Referenced by Create(), InitStatsForLevel(), and LoadFromDB().

◆ SetOriginalGroup()

void Player::SetOriginalGroup ( Group group,
int8  subgroup = -1 
)
13079{
13080 if (!group)
13082 else
13083 {
13084 // never use SetOriginalGroup without a subgroup unless you specify nullptr for group
13085 ASSERT(subgroup >= 0);
13086 m_originalGroup.link(group, this);
13088 }
13089}

References ASSERT, Reference< TO, FROM >::link(), m_originalGroup, GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::AddMember(), Group::Disband(), RemoveFromBattlegroundOrBattlefieldRaid(), Group::RemoveMember(), and SetBattlegroundOrBattlefieldRaid().

◆ SetPassOnGroupLoot()

void Player::SetPassOnGroupLoot ( bool  bPassOnGroupLoot)
inline
2505{ m_bPassOnGroupLoot = bPassOnGroupLoot; }

References m_bPassOnGroupLoot.

Referenced by WorldSession::HandleOptOutOfLootOpcode().

◆ SetPendingBind()

void Player::SetPendingBind ( uint32  instanceId,
uint32  bindTimer 
)
inline

◆ SetPendingSpectatorForBG()

void Player::SetPendingSpectatorForBG ( uint32  bgInstanceId)
inline

◆ SetPendingSpectatorInviteInstanceId()

void Player::SetPendingSpectatorInviteInstanceId ( uint32  bgInstanceId)
inline

◆ SetPlayerFlag()

◆ SetPvP()

void Player::SetPvP ( bool  state)
inline
1864 {
1865 Unit::SetPvP(state);
1866 if (!m_Controlled.empty())
1867 for (auto& itr : m_Controlled)
1868 itr->SetPvP(state);
1869 }
void SetPvP(bool state)
Definition Player.h:1863
ControlSet m_Controlled
Definition Unit.h:1990
void SetPvP(bool state)
Definition Unit.h:985

References Unit::m_Controlled, and Unit::SetPvP().

Referenced by UpdatePvP().

◆ SetPvPDeath()

void Player::SetPvPDeath ( bool  on)
inline
1190{ if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }

References m_ExtraFlags, and PLAYER_EXTRA_PVP_DEATH.

Referenced by CreateCorpse().

◆ SetQuestSlot()

◆ SetQuestSlotCounter()

void Player::SetQuestSlotCounter ( uint16  slot,
uint8  counter,
uint16  count 
)
inline

◆ SetQuestSlotState()

void Player::SetQuestSlotState ( uint16  slot,
uint32  state 
)
inline

◆ SetQuestSlotTimer()

void Player::SetQuestSlotTimer ( uint16  slot,
uint32  timer 
)
inline

◆ SetQuestStatus()

void Player::SetQuestStatus ( uint32  questId,
QuestStatus  status,
bool  update = true 
)
1480{
1481 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
1482 {
1483 m_QuestStatus[questId].Status = status;
1484
1485 if (quest->GetQuestMethod() && !quest->IsAutoComplete())
1486 {
1487 m_QuestStatusSave[questId] = true;
1488 }
1489 }
1490
1491 if (update)
1492 SendQuestUpdate(questId);
1493}

References m_QuestStatus, m_QuestStatusSave, SendQuestUpdate(), and sObjectMgr.

Referenced by CompleteQuest(), FailQuest(), IncompleteQuest(), and npc_finklestein::npc_finklesteinAI::RightClickCauldron().

◆ SetRaidDifficulty()

void Player::SetRaidDifficulty ( Difficulty  raid_difficulty)
inline

◆ SetRandomWinner()

void Player::SetRandomWinner ( bool  isWinner)
15674{
15675 m_IsBGRandomWinner = isWinner;
15677 {
15679 stmt->SetData(0, GetGUID().GetCounter());
15680 CharacterDatabase.Execute(stmt);
15681 }
15682}
@ CHAR_INS_BATTLEGROUND_RANDOM
Definition CharacterDatabase.h:64

References CHAR_INS_BATTLEGROUND_RANDOM, CharacterDatabase, Object::GetGUID(), m_IsBGRandomWinner, and PreparedStatementBase::SetData().

◆ SetRank()

void Player::SetRank ( uint8  rankId)
inline

◆ setRegenTimerCount()

void Player::setRegenTimerCount ( uint32  time)
inline
1618{m_regenTimerCount = time;}

References m_regenTimerCount.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetRegularAttackTime()

void Player::SetRegularAttackTime ( )
5327{
5328 for (uint8 i = 0; i < MAX_ATTACK; ++i)
5329 {
5330 Item* tmpitem = GetWeaponForAttack(WeaponAttackType(i), true);
5331 if (tmpitem && !tmpitem->IsBroken())
5332 {
5333 ItemTemplate const* proto = tmpitem->GetTemplate();
5334 if (proto->Delay)
5336 }
5337 else
5338 SetAttackTime(WeaponAttackType(i), BASE_ATTACK_TIME); // If there is no weapon reset attack time to base (might have been changed from forms)
5339 }
5340}

References BASE_ATTACK_TIME, ItemTemplate::Delay, Item::GetTemplate(), GetWeaponForAttack(), Item::IsBroken(), MAX_ATTACK, and Unit::SetAttackTime().

Referenced by InitDataForForm().

◆ SetReputation()

void Player::SetReputation ( uint32  factionentry,
float  value 
)
15302{
15303 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
15304}
bool SetReputation(FactionEntry const *factionEntry, float standing)
Definition ReputationMgr.h:113

References GetReputationMgr(), ReputationMgr::SetReputation(), and sFactionStore.

◆ SetRestBonus()

void Player::SetRestBonus ( float  restBonusNew)
10189{
10190 // Prevent resting on max level
10191 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
10192 restBonusNew = 0;
10193
10194 if (restBonusNew < 0)
10195 restBonusNew = 0;
10196
10197 // Fetch rest bonus multiplier from cached configuration
10198 float restBonusMultiplier = sWorld->getRate(RATE_REST_MAX_BONUS);
10199
10200 // Calculate rest bonus max using the multiplier
10201 float restBonusMax = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) * restBonusMultiplier / 2;
10202
10203 if (restBonusNew > restBonusMax)
10204 _restBonus = restBonusMax;
10205 else
10206 _restBonus = restBonusNew;
10207 // update data for client
10208 if ((GetsRecruitAFriendBonus(true) && (GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0)))
10210 else
10211 {
10212 if (_restBonus > 10)
10214 else if (_restBonus <= 1)
10216 }
10217
10218 //RestTickUpdate
10220}
@ REST_STATE_RESTED
Definition Player.h:991
@ PLAYER_REST_STATE_EXPERIENCE
Definition UpdateFields.h:358
@ RATE_REST_MAX_BONUS
Definition WorldConfig.h:456

References _restBonus, CONFIG_MAX_PLAYER_LEVEL, Unit::GetLevel(), GetSession(), GetsRecruitAFriendBonus(), Object::GetUInt32Value(), PLAYER_BYTES_2, PLAYER_NEXT_LEVEL_XP, PLAYER_REST_STATE_EXPERIENCE, RATE_REST_MAX_BONUS, REST_STATE_NOT_RAF_LINKED, REST_STATE_RAF_LINKED, REST_STATE_RESTED, Object::SetByteValue(), Unit::SetUInt32Value(), and sWorld.

Referenced by GetXPRestBonus(), LoadFromDB(), and Update().

◆ SetRestFlag()

void Player::SetRestFlag ( RestFlag  restFlag,
uint32  triggerId = 0 
)
16118{
16119 uint32 oldRestMask = _restFlagMask;
16120 _restFlagMask |= restFlag;
16121
16122 if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
16123 {
16124 _restTime = GameTime::GetGameTime().count();
16126 }
16127
16128 if (triggerId)
16129 _innTriggerId = triggerId;
16130}

References _innTriggerId, _restFlagMask, _restTime, GameTime::GetGameTime(), PLAYER_FLAGS_RESTING, and SetPlayerFlag().

Referenced by WorldSession::HandleAreaTriggerOpcode(), LoadFromDB(), UpdateArea(), and UpdateZone().

◆ SetRestState()

void Player::SetRestState ( uint32  triggerId)

◆ setResurrectRequestData()

void Player::setResurrectRequestData ( ObjectGuid  guid,
uint32  mapId,
float  X,
float  Y,
float  Z,
uint32  health,
uint32  mana 
)
inline

◆ SetRewardedQuest()

void Player::SetRewardedQuest ( uint32  quest_id)
881{
882 m_RewardedQuests.insert(quest_id);
883 m_RewardedQuestsSave[quest_id] = true;
884}

References m_RewardedQuests, and m_RewardedQuestsSave.

Referenced by Spell::EffectQuestComplete(), and RewardQuest().

◆ SetRuneConvertAura()

void Player::SetRuneConvertAura ( uint8  index,
AuraEffect const *  aura 
)
inline

◆ SetRuneCooldown()

void Player::SetRuneCooldown ( uint8  index,
uint32  cooldown 
)
inline

◆ setRuneWeaponGUID()

void Player::setRuneWeaponGUID ( ObjectGuid  guid)
inline
2608{ m_drwGUID = guid; };

References m_drwGUID.

◆ SetSaveTimer()

void Player::SetSaveTimer ( uint32  timer)
inline
2374{ m_nextSave = timer; }

References m_nextSave.

◆ SetSeasonalQuestStatus()

void Player::SetSeasonalQuestStatus ( uint32  quest_id)
12108{
12109 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
12110 if (!quest)
12111 return;
12112
12113 m_seasonalquests[quest->GetEventIdForQuest()].insert(quest_id);
12115}
uint16 GetEventIdForQuest() const
Definition QuestDef.h:332

References Quest::GetEventIdForQuest(), m_SeasonalQuestChanged, m_seasonalquests, and sObjectMgr.

Referenced by RewardQuest().

◆ SetSeer()

void Player::SetSeer ( WorldObject target)
inline
2367{ m_seer = target; }

References m_seer.

Referenced by WorldSession::HandleFarSightOpcode(), and SetViewpoint().

◆ SetSelection()

void Player::SetSelection ( ObjectGuid  guid)

Used for serverside target changes, does not apply to players.

11525{
11527
11530}
void SendCommand_GUID(T *o, ObjectGuid targetGUID, const char *prefix, ObjectGuid t)
Definition ArenaSpectator.h:71

References WorldObject::FindMap(), Object::GetGUID(), NeedSendSpectatorData(), ArenaSpectator::SendCommand_GUID(), Object::SetGuidValue(), and UNIT_FIELD_TARGET.

Referenced by WorldSession::HandleSetSelectionOpcode(), and TeleportTo().

◆ SetSemaphoreTeleportFar()

void Player::SetSemaphoreTeleportFar ( time_t  tm)
inline

◆ SetSemaphoreTeleportNear()

void Player::SetSemaphoreTeleportNear ( time_t  tm)
inline

◆ SetServerSideVisibility()

void Player::SetServerSideVisibility ( ServerSideVisibilityType  type,
AccountTypes  sec 
)
16224{
16225 sScriptMgr->OnPlayerSetServerSideVisibility(this, type, sec);
16226
16228}

References WorldObject::m_serverSideVisibility, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and sScriptMgr.

◆ SetServerSideVisibilityDetect()

void Player::SetServerSideVisibilityDetect ( ServerSideVisibilityType  type,
AccountTypes  sec 
)
16231{
16232 sScriptMgr->OnPlayerSetServerSideVisibilityDetect(this, type, sec);
16233
16235}

References WorldObject::m_serverSideVisibilityDetect, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and sScriptMgr.

◆ SetSession()

void Player::SetSession ( WorldSession sess)
inline
2017{ m_session = sess; }

References m_session.

Referenced by WorldSession::HandlePlayerLoginOpcode().

◆ SetSheath()

void Player::SetSheath ( SheathState  sheathed)
overridevirtual

Reimplemented from Unit.

98{
99 switch (sheathed)
100 {
101 case SHEATH_STATE_UNARMED: // no prepared weapon
102 SetVirtualItemSlot(0, nullptr);
103 SetVirtualItemSlot(1, nullptr);
104 SetVirtualItemSlot(2, nullptr);
105 break;
106 case SHEATH_STATE_MELEE: // prepared melee weapon
109 SetVirtualItemSlot(2, nullptr);
110 break;
111 case SHEATH_STATE_RANGED: // prepared ranged weapon
112 SetVirtualItemSlot(0, nullptr);
113 SetVirtualItemSlot(1, nullptr);
115 break;
116 default:
117 SetVirtualItemSlot(0, nullptr);
118 SetVirtualItemSlot(1, nullptr);
119 SetVirtualItemSlot(2, nullptr);
120 break;
121 }
122 Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
123}
@ SHEATH_STATE_UNARMED
Definition UnitDefines.h:126
@ SHEATH_STATE_MELEE
Definition UnitDefines.h:127
@ SHEATH_STATE_RANGED
Definition UnitDefines.h:128
void SetVirtualItemSlot(uint8 i, Item *item)
Definition PlayerStorage.cpp:77
virtual void SetSheath(SheathState sheathed)
Definition Unit.h:1692

References BASE_ATTACK, GetWeaponForAttack(), OFF_ATTACK, RANGED_ATTACK, Unit::SetSheath(), SetVirtualItemSlot(), SHEATH_STATE_MELEE, SHEATH_STATE_RANGED, and SHEATH_STATE_UNARMED.

Referenced by WorldSession::HandleSetSheathedOpcode().

◆ SetShowDKPet()

void Player::SetShowDKPet ( bool  on)
inline

◆ SetSkill()

void Player::SetSkill ( uint16  id,
uint16  step,
uint16  currVal,
uint16  maxVal 
)
5363{
5364 if (!id)
5365 return;
5366
5367 uint16 currVal;
5368 SkillStatusMap::iterator itr = mSkillStatus.find(id);
5369
5370 //has skill
5371 if (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
5372 {
5373 currVal = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
5374 if (newVal)
5375 {
5376 // if skill value is going down, update enchantments before setting the new value
5377 if (newVal < currVal)
5378 UpdateSkillEnchantments(id, currVal, newVal);
5379 // update step
5380 SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), MAKE_PAIR32(id, step));
5381 // update value
5382 SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_SKILL_VALUE(newVal, maxVal));
5383 if (itr->second.uState != SKILL_NEW)
5384 itr->second.uState = SKILL_CHANGED;
5385 learnSkillRewardedSpells(id, newVal);
5386 // if skill value is going up, update enchantments after setting the new value
5387 if (newVal > currVal)
5388 UpdateSkillEnchantments(id, currVal, newVal);
5391 }
5392 else //remove
5393 {
5394 //remove enchantments needing this skill
5395 UpdateSkillEnchantments(id, currVal, 0);
5396 // clear skill fields
5397 SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), 0);
5398 SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), 0);
5399 SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos), 0);
5400
5401 // mark as deleted or simply remove from map if not saved yet
5402 if (itr->second.uState != SKILL_NEW)
5403 itr->second.uState = SKILL_DELETED;
5404 else
5405 mSkillStatus.erase(itr);
5406
5407 // remove all spells that related to this skill
5409 removeSpell(sSpellMgr->GetFirstSpellInChain(pAbility->Spell), SPEC_MASK_ALL, false);
5410 }
5411 }
5412 else if (newVal) //add
5413 {
5414 currVal = 0;
5415 for (int i = 0; i < PLAYER_MAX_SKILLS; ++i)
5417 {
5418 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
5419 if (!pSkill)
5420 {
5421 LOG_ERROR("entities.player", "Skill not found in SkillLineStore: skill #{}", id);
5422 return;
5423 }
5424
5427 UpdateSkillEnchantments(id, currVal, newVal);
5428
5429 // insert new entry or update if not deleted old entry yet
5430 if (itr != mSkillStatus.end())
5431 {
5432 itr->second.pos = i;
5433 itr->second.uState = SKILL_CHANGED;
5434 }
5435 else
5436 mSkillStatus.insert(SkillStatusMap::value_type(id, SkillStatusData(i, SKILL_NEW)));
5437
5438 // apply skill bonuses
5440
5441 // temporary bonuses
5443 for (AuraEffectList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j)
5444 if ((*j)->GetMiscValue() == int32(id))
5445 (*j)->HandleEffect(this, AURA_EFFECT_HANDLE_SKILL, true);
5446
5447 // permanent bonuses
5449 for (AuraEffectList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j)
5450 if ((*j)->GetMiscValue() == int32(id))
5451 (*j)->HandleEffect(this, AURA_EFFECT_HANDLE_SKILL, true);
5452
5453 // Learn all spells for skill
5454 learnSkillRewardedSpells(id, newVal);
5457 return;
5458 }
5459 }
5460}
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL
Definition DBCEnums.h:125
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL
Definition DBCEnums.h:154
@ SPELL_AURA_MOD_SKILL
Definition SpellAuraDefines.h:93
@ SPELL_AURA_MOD_SKILL_TALENT
Definition SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition SpellAuraDefines.h:47
void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value)
Definition PlayerStorage.cpp:4688

References ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, AURA_EFFECT_HANDLE_SKILL, Unit::GetAuraEffectsByType(), GetSkillLineAbilitiesBySkillLine(), Object::GetUInt32Value(), learnSkillRewardedSpells(), LOG_ERROR, MAKE_PAIR32(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_MAX_SKILLS, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_INDEX, PLAYER_SKILL_VALUE_INDEX, removeSpell(), Unit::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_NEW, SKILL_VALUE, SPEC_MASK_ALL, SPELL_AURA_MOD_SKILL, SPELL_AURA_MOD_SKILL_TALENT, sSkillLineStore, sSpellMgr, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by _addSpell(), Spell::EffectLearnSkill(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), misc_commandscript::HandleSetSkillCommand(), WorldSession::HandleUnlearnSkillOpcode(), LearnDefaultSkill(), and removeSpell().

◆ SetSpecsCount()

void Player::SetSpecsCount ( uint8  count)
inline
1758{ m_specsCount = count; }

References m_specsCount.

Referenced by UpdateSpecCount().

◆ SetSpellModTakingSpell()

void Player::SetSpellModTakingSpell ( Spell spell,
bool  apply 
)
10067{
10068 if (apply && m_spellModTakingSpell)
10069 {
10070 LOG_INFO("misc", "Player::SetSpellModTakingSpell (A1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
10071 return;
10072 //ASSERT(m_spellModTakingSpell == nullptr);
10073 }
10074 else if (!apply)
10075 {
10077 LOG_INFO("misc", "Player::SetSpellModTakingSpell (B1) - {}", spell->m_spellInfo->Id);
10078 else if (m_spellModTakingSpell != spell)
10079 {
10080 LOG_INFO("misc", "Player::SetSpellModTakingSpell (C1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
10081 return;
10082 }
10083 //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell);
10084 }
10085
10086 m_spellModTakingSpell = apply ? spell : nullptr;
10087}

References SpellInfo::Id, LOG_INFO, Spell::m_spellInfo, and m_spellModTakingSpell.

Referenced by Spell::_cast(), Spell::cast(), Spell::handle_delayed(), Unit::HandleDummyAuraProc(), and Aura::UpdateOwner().

◆ SetSummonAsSpectator()

void Player::SetSummonAsSpectator ( bool  on)
inline

◆ SetSummonPoint()

void Player::SetSummonPoint ( uint32  mapid,
float  x,
float  y,
float  z,
uint32  delay = 0,
bool  asSpectator = false 
)
16286{
16287 m_summon_expire = GameTime::GetGameTime().count() + (delay ? delay : MAX_PLAYER_SUMMON_DELAY);
16288 m_summon_mapid = mapid;
16289 m_summon_x = x;
16290 m_summon_y = y;
16291 m_summon_z = z;
16292 m_summon_asSpectator = asSpectator;
16293}
#define MAX_PLAYER_SUMMON_DELAY
Definition Player.h:936

References GameTime::GetGameTime(), m_summon_asSpectator, m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, and MAX_PLAYER_SUMMON_DELAY.

Referenced by Spell::EffectSummonPlayer(), and Spell::EffectSummonRaFFriend().

◆ SetTarget()

void Player::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
inlineoverridevirtual

Implements Unit.

1651{ }

◆ SetTaxiCheater()

void Player::SetTaxiCheater ( bool  on)
inline

◆ setTeamId()

void Player::setTeamId ( TeamId  teamid)
inline
2128{ m_team = teamid; };

References m_team.

◆ SetTemporaryUnsummonedPetNumber()

void Player::SetTemporaryUnsummonedPetNumber ( uint32  petnumber)
inline

◆ SetTitle()

void Player::SetTitle ( CharTitlesEntry const *  title,
bool  lost = false 
)
13302{
13303 uint32 fieldIndexOffset = title->bit_index / 32;
13304 uint32 flag = 1 << (title->bit_index % 32);
13305
13306 if (lost)
13307 {
13308 if (!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
13309 return;
13310
13311 // Clear the current title if it is the one being removed.
13312 if (title->bit_index == GetUInt32Value(PLAYER_CHOSEN_TITLE))
13313 {
13314 SetCurrentTitle(nullptr, true);
13315 }
13316
13317 RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13318 }
13319 else
13320 {
13321 if (HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
13322 return;
13323
13324 SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13325 }
13326
13327 WorldPacket data(SMSG_TITLE_EARNED, 4 + 4);
13328 data << uint32(title->bit_index);
13329 data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost
13330 GetSession()->SendPacket(&data);
13331
13333}
@ ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK
Definition DBCEnums.h:158
void SetCurrentTitle(CharTitlesEntry const *title, bool clear=false)
Definition Player.h:2561
@ SMSG_TITLE_EARNED
Definition Opcodes.h:913

References ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK, CharTitlesEntry::bit_index, GetSession(), Object::GetUInt32Value(), Object::HasFlag(), PLAYER__FIELD_KNOWN_TITLES, PLAYER_CHOSEN_TITLE, Object::RemoveFlag(), WorldSession::SendPacket(), SetCurrentTitle(), Object::SetFlag(), SMSG_TITLE_EARNED, and UpdateAchievementCriteria().

Referenced by _LoadQuestStatusRewarded(), AchievementMgr::CompletedAchievement(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), AchievementMgr::LoadFromDB(), and RewardQuest().

◆ SetViewpoint()

void Player::SetViewpoint ( WorldObject target,
bool  apply 
)
13136{
13137 if (apply)
13138 {
13139 LOG_DEBUG("maps", "Player::CreateViewpoint: Player {} create seer {} (TypeId: {}).", GetName(), target->GetEntry(), target->GetTypeId());
13140
13141 if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
13142 {
13143 LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot add new viewpoint!", GetName());
13144 return;
13145 }
13146
13147 // farsight dynobj or puppet may be very far away
13148 UpdateVisibilityOf(target);
13149
13150 if (target->IsUnit() && !GetVehicle())
13151 ((Unit*)target)->AddPlayerToVision(this);
13152 SetSeer(target);
13153 }
13154 else
13155 {
13156 //must immediately set seer back otherwise may crash
13157 m_seer = this;
13158
13159 LOG_DEBUG("maps", "Player::CreateViewpoint: Player {} remove seer", GetName());
13160
13161 if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
13162 {
13163 LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot remove current viewpoint!", GetName());
13164 return;
13165 }
13166
13167 if (target->IsUnit() && !GetVehicle())
13168 static_cast<Unit*>(target)->RemovePlayerFromVision(this);
13169
13170 // must immediately set seer back otherwise may crash
13171 SetSeer(this);
13172
13173 //WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
13174 //GetSession()->SendPacket(&data);
13175 }
13176}
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:675
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:693
void SetSeer(WorldObject *target)
Definition Player.h:2367
void UpdateVisibilityOf(WorldObject *target)
Definition PlayerUpdates.cpp:1719

References Object::AddGuidValue(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), Unit::GetVehicle(), Object::IsUnit(), LOG_DEBUG, m_seer, PLAYER_FARSIGHT, Object::RemoveGuidValue(), Unit::RemovePlayerFromVision(), SetSeer(), and UpdateVisibilityOf().

Referenced by CinematicMgr::BeginCinematic(), CinematicMgr::EndCinematic(), AuraEffect::HandleBindSight(), WorldSession::HandleFarSightOpcode(), RemoveFromWorld(), and SetClientControl().

◆ SetVirtualItemSlot()

void Player::SetVirtualItemSlot ( uint8  i,
Item item 
)
Todo:
: this import is not necessary for compilation and marked as unused by the IDE
78{
79 ASSERT(i < 3);
80 if (i < 2 && item)
81 {
83 return;
85 if (charges == 0)
86 return;
87 if (charges > 1)
89 else if (charges <= 1)
90 {
93 }
94 }
95}

References ApplyEnchantment(), ASSERT, Item::ClearEnchantment(), Item::GetEnchantmentCharges(), Item::GetEnchantmentId(), Item::SetEnchantmentCharges(), and TEMP_ENCHANTMENT_SLOT.

Referenced by SetSheath().

◆ SetVisibleItemSlot()

void Player::SetVisibleItemSlot ( uint8  slot,
Item pItem 
)

◆ SetWaterWalking()

bool Player::SetWaterWalking ( bool  enable,
bool  packetOnly = false 
)
overridevirtual

Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.

movement counter

Reimplemented from Unit.

15931{
15932 // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15933 if (!packetOnly /* && !Unit::SetWaterWalking(apply)*/)
15934 {
15935 Unit::SetWaterWalking(apply);
15936 // return false;
15937 }
15938
15940 data << GetPackGUID();
15941 data << uint32(0);
15942 SendDirectMessage(&data);
15943
15945 data << GetPackGUID();
15946 BuildMovementPacket(&data);
15947 SendMessageToSet(&data, false);
15948 return true;
15949}
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for...
Definition Unit.cpp:20488
@ MSG_MOVE_WATER_WALK
Definition Opcodes.h:719

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_WATER_WALK, SendDirectMessage(), SendMessageToSet(), Unit::SetWaterWalking(), SMSG_MOVE_LAND_WALK, and SMSG_MOVE_WATER_WALK.

Referenced by BuildPlayerRepop(), and ResurrectPlayer().

◆ setWeaponChangeTimer()

void Player::setWeaponChangeTimer ( uint32  time)
inline
1619{m_weaponChangeTimer = time;}

References m_weaponChangeTimer.

◆ SetWeeklyQuestStatus()

void Player::SetWeeklyQuestStatus ( uint32  quest_id)
12102{
12103 m_weeklyquests.insert(quest_id);
12104 m_WeeklyQuestChanged = true;
12105}

References m_WeeklyQuestChanged, and m_weeklyquests.

Referenced by RewardQuest().

◆ SpawnCorpseBones()

void Player::SpawnCorpseBones ( bool  triggerSave = true)
4721{
4723 if (GetMap()->ConvertCorpseToBones(GetGUID()))
4724 if (triggerSave && !GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
4725 {
4726 // prevent loading as ghost without corpse
4727 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
4728
4729 // pussywizard: update only ghost flag instead of whole character table entry! data integrity is crucial
4731 stmt->SetData(0, GetGUID().GetCounter());
4732 trans->Append(stmt);
4733
4734 _SaveAuras(trans, false);
4735
4736 CharacterDatabase.CommitTransaction(trans);
4737 }
4738}
@ CHAR_UPD_CHAR_REMOVE_GHOST
Definition CharacterDatabase.h:431

References _corpseLocation, _SaveAuras(), CHAR_UPD_CHAR_REMOVE_GHOST, CharacterDatabase, Object::GetGUID(), WorldObject::GetMap(), GetSession(), PreparedStatementBase::SetData(), and WorldLocation::WorldRelocate().

Referenced by Battleground::_ProcessResurrect(), CreateCorpse(), Spell::EffectSelfResurrect(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleBattleFieldPortOpcode(), group_commandscript::HandleGroupReviveCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleReclaimCorpseOpcode(), LoadCorpse(), ProcessDelayedOperations(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), ResurectUsingRequestData(), BfGraveyard::Resurrect(), and WorldSession::SendSpiritResurrect().

◆ SplitItem()

void Player::SplitItem ( uint16  src,
uint16  dst,
uint32  count 
)

If trading

If current item is in trade window (only possible with packet spoofing - silent return)

3422{
3423 uint8 srcbag = src >> 8;
3424 uint8 srcslot = src & 255;
3425
3426 uint8 dstbag = dst >> 8;
3427 uint8 dstslot = dst & 255;
3428
3429 Item* pSrcItem = GetItemByPos(srcbag, srcslot);
3430 if (!pSrcItem)
3431 {
3432 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr);
3433 return;
3434 }
3435
3436 if (pSrcItem->m_lootGenerated) // prevent split looting item (item
3437 {
3438 //best error message found for attempting to split while looting
3440 return;
3441 }
3442
3443 // not let split all items (can be only at cheating)
3444 if (pSrcItem->GetCount() == count)
3445 {
3447 return;
3448 }
3449
3450 // not let split more existed items (can be only at cheating)
3451 if (pSrcItem->GetCount() < count)
3452 {
3454 return;
3455 }
3456
3458 if (TradeData* tradeData = GetTradeData())
3459 {
3461 if (tradeData->GetTradeSlotForItem(pSrcItem->GetGUID()) != TRADE_SLOT_INVALID)
3462 return;
3463 }
3464
3465 LOG_DEBUG("entities.player.items", "STORAGE: SplitItem bag = {}, slot = {}, item = {}, count = {}", dstbag, dstslot, pSrcItem->GetEntry(), count);
3466 Item* pNewItem = pSrcItem->CloneItem(count, this);
3467 if (!pNewItem)
3468 {
3469 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr);
3470 return;
3471 }
3472
3473 if (IsInventoryPos(dst))
3474 {
3475 // change item amount before check (for unique max count check)
3476 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3477
3478 ItemPosCountVec dest;
3479 InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false);
3480 if (msg != EQUIP_ERR_OK)
3481 {
3482 delete pNewItem;
3483 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3484 SendEquipError(msg, pSrcItem, nullptr);
3485 return;
3486 }
3487
3488 if (IsInWorld())
3489 pSrcItem->SendUpdateToPlayer(this);
3490 pSrcItem->SetState(ITEM_CHANGED, this);
3491 StoreItem(dest, pNewItem, true);
3492 }
3493 else if (IsBankPos(dst))
3494 {
3495 // change item amount before check (for unique max count check)
3496 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3497
3498 ItemPosCountVec dest;
3499 InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false);
3500 if (msg != EQUIP_ERR_OK)
3501 {
3502 delete pNewItem;
3503 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3504 SendEquipError(msg, pSrcItem, nullptr);
3505 return;
3506 }
3507
3508 if (IsInWorld())
3509 pSrcItem->SendUpdateToPlayer(this);
3510 pSrcItem->SetState(ITEM_CHANGED, this);
3511 BankItem(dest, pNewItem, true);
3512 }
3513 else if (IsEquipmentPos(dst))
3514 {
3515 // change item amount before check (for unique max count check), provide space for splitted items
3516 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3517
3518 uint16 dest;
3519 InventoryResult msg = CanEquipItem(dstslot, dest, pNewItem, false);
3520 if (msg != EQUIP_ERR_OK)
3521 {
3522 delete pNewItem;
3523 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3524 SendEquipError(msg, pSrcItem, nullptr);
3525 return;
3526 }
3527
3528 if (IsInWorld())
3529 pSrcItem->SendUpdateToPlayer(this);
3530 pSrcItem->SetState(ITEM_CHANGED, this);
3531 EquipItem(dest, pNewItem, true);
3533 }
3534}
@ EQUIP_ERR_COULDNT_SPLIT_ITEMS
Definition Item.h:74
@ EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT
Definition Item.h:73
@ TRADE_SLOT_INVALID
Definition TradeData.h:32
TradeData * GetTradeData() const
Definition Player.h:1392
Definition TradeData.h:36

References AutoUnequipOffhandIfNeed(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), Item::CloneItem(), EQUIP_ERR_COULDNT_SPLIT_ITEMS, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, EquipItem(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), GetTradeData(), IsBankPos(), IsEquipmentPos(), IsInventoryPos(), Object::IsInWorld(), ITEM_CHANGED, LOG_DEBUG, Item::m_lootGenerated, SendEquipError(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), StoreItem(), and TRADE_SLOT_INVALID.

Referenced by WorldSession::HandleSplitItemOpcode().

◆ StartTimedAchievement()

void Player::StartTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry,
uint32  timeLost = 0 
)
13893{
13894 m_achievementMgr->StartTimedAchievement(type, entry, timeLost);
13895}
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition AchievementMgr.cpp:2221

References m_achievementMgr, and AchievementMgr::StartTimedAchievement().

Referenced by Spell::_cast(), AddQuest(), Spell::DoSpellHitOnUnit(), InstanceScript::DoStartTimedAchievement(), BattlegroundWS::EventPlayerClickedOnFlag(), and KilledMonsterCredit().

◆ StopCastingBindSight()

void Player::StopCastingBindSight ( Aura except = nullptr)
13123{
13124 if (WorldObject* target = GetViewpoint())
13125 {
13126 if (target->IsUnit())
13127 {
13128 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, GetGUID(), except);
13129 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS, GetGUID(), except);
13130 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET, GetGUID(), except);
13131 }
13132 }
13133}
@ SPELL_AURA_MOD_POSSESS_PET
Definition SpellAuraDefines.h:191
@ SPELL_AURA_MOD_POSSESS
Definition SpellAuraDefines.h:65
@ SPELL_AURA_BIND_SIGHT
Definition SpellAuraDefines.h:64

References Object::GetGUID(), GetViewpoint(), SPELL_AURA_BIND_SIGHT, SPELL_AURA_MOD_POSSESS, and SPELL_AURA_MOD_POSSESS_PET.

Referenced by ActivateTaxiPathTo(), misc_commandscript::HandleUnbindSightCommand(), RemoveFromWorld(), and Unit::SetCharmedBy().

◆ StopCastingCharm()

void Player::StopCastingCharm ( Aura except = nullptr)
9324{
9325 Unit* charm = GetCharm();
9326 if (!charm)
9327 {
9328 return;
9329 }
9330
9331 if (charm->IsCreature())
9332 {
9334 {
9335 ((Puppet*)charm)->UnSummon();
9336 }
9337 else if (charm->IsVehicle())
9338 {
9339 ExitVehicle();
9340 }
9341 }
9342
9343 if (GetCharmGUID())
9344 {
9349 }
9350
9351 if (GetCharmGUID())
9352 {
9353 LOG_FATAL("entities.player", "Player {} ({} is not able to uncharm unit ({})", GetName(), GetGUID().ToString(), GetCharmGUID().ToString());
9354
9355 if (charm->GetCharmerGUID())
9356 {
9357 LOG_FATAL("entities.player", "Charmed unit has charmer {}", charm->GetCharmerGUID().ToString());
9358 ABORT();
9359 }
9360 else
9361 {
9362 SetCharm(charm, false);
9363 }
9364 }
9365}
#define ABORT
Definition Errors.h:76
@ SPELL_AURA_MOD_CHARM
Definition SpellAuraDefines.h:69
@ SPELL_AURA_AOE_CHARM
Definition SpellAuraDefines.h:240
@ UNIT_MASK_PUPPET
Definition UnitDefines.h:162
Definition TemporarySummon.h:115
bool IsVehicle() const
Definition Unit.h:750
void SetCharm(Unit *target, bool apply)
Definition Unit.cpp:10962
ObjectGuid GetCharmGUID() const
Definition Unit.h:676

References ABORT, ObjectGuid::Empty, Unit::ExitVehicle(), Unit::GetCharm(), Unit::GetCharmerGUID(), Unit::GetCharmGUID(), Object::GetGUID(), WorldObject::GetName(), Unit::HasUnitTypeMask(), Object::IsCreature(), Unit::IsVehicle(), LOG_FATAL, Unit::RemoveAurasByType(), Unit::SetCharm(), SPELL_AURA_AOE_CHARM, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_POSSESS_PET, Object::ToCreature(), ObjectGuid::ToString(), Position::ToString(), and UNIT_MASK_PUPPET.

Referenced by ActivateTaxiPathTo(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), Unit::RemoveAllControlled(), RemoveFromWorld(), Unit::SetCharmedBy(), and npc_chesspiece::sGossipSelect().

◆ StopMirrorTimer()

void Player::StopMirrorTimer ( MirrorTimerType  Type)
protected

◆ StopMirrorTimers()

◆ StoreItem()

Item * Player::StoreItem ( ItemPosCountVec const &  pos,
Item pItem,
bool  update 
)
2575{
2576 if (!pItem)
2577 return nullptr;
2578
2579 Item* lastItem = pItem;
2580 ItemTemplate const* proto = pItem->GetTemplate();
2581
2582 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();)
2583 {
2584 uint16 pos = itr->pos;
2585 uint32 count = itr->count;
2586
2587 ++itr;
2588
2589 if (itr == dest.end())
2590 {
2591 lastItem = _StoreItem(pos, pItem, count, false, update);
2592 break;
2593 }
2594
2595 lastItem = _StoreItem(pos, pItem, count, true, update);
2596 }
2597
2598 // cast after item storing - some checks in checkcast requires item to be present!!
2599 if (lastItem)
2600 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
2601 if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
2602 if (!HasAura(proto->Spells[i].SpellId))
2603 CastSpell(this, proto->Spells[i].SpellId, true, lastItem);
2604
2605 return lastItem;
2606}
Item * _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update)
Definition PlayerStorage.cpp:2609

References _StoreItem(), Unit::CastSpell(), Item::GetTemplate(), Unit::HasAura(), ITEM_SPELLTRIGGER_ON_NO_DELAY_USE, MAX_ITEM_PROTO_SPELLS, _Spell::SpellId, ItemTemplate::Spells, and _Spell::SpellTrigger.

Referenced by _LoadInventory(), AutoUnequipOffhandIfNeed(), BankItem(), Create(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleMailCreateTextItem(), MoveItemToInventory(), SplitItem(), StoreNewItem(), and SwapItem().

◆ StoreLootItem()

LootItem * Player::StoreLootItem ( uint8  lootSlot,
Loot loot,
InventoryResult msg 
)
13483{
13484 QuestItem* qitem = nullptr;
13485 QuestItem* ffaitem = nullptr;
13486 QuestItem* conditem = nullptr;
13487
13488 msg = EQUIP_ERR_OK;
13489
13490 LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
13491 if (!item || item->is_looted)
13492 {
13493 if (!sScriptMgr->OnPlayerCanSendErrorAlreadyLooted(this))
13494 {
13495 SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
13496 }
13497 return nullptr;
13498 }
13499
13500 // Xinef: exploit protection, dont allow to loot normal items if player is not master loot and not below loot threshold
13501 // Xinef: only quest, ffa and conditioned items
13502 if (!item->is_underthreshold && loot->roundRobinPlayer && !GetLootGUID().IsItem() && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid())
13503 if (!qitem && !ffaitem && !conditem)
13504 {
13506 return nullptr;
13507 }
13508
13509 if (!item->AllowedForPlayer(this, loot->sourceWorldObjectGUID))
13510 {
13512 return nullptr;
13513 }
13514
13515 // questitems use the blocked field for other purposes
13516 if (!qitem && item->is_blocked)
13517 {
13519 return nullptr;
13520 }
13521
13522 // xinef: dont allow protected item to be looted by someone else
13523 if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID())
13524 {
13526 return nullptr;
13527 }
13528
13529 ItemPosCountVec dest;
13530 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
13531 if (msg == EQUIP_ERR_OK)
13532 {
13533 AllowedLooterSet looters = item->GetAllowedLooters();
13534 Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, looters);
13535
13536 if (qitem)
13537 {
13538 qitem->is_looted = true;
13539 //freeforall is 1 if everyone's supposed to get the quest item.
13540 if (item->freeforall || loot->GetPlayerQuestItems().size() == 1)
13541 SendNotifyLootItemRemoved(lootSlot);
13542 else
13543 loot->NotifyQuestItemRemoved(qitem->index);
13544 }
13545 else
13546 {
13547 if (ffaitem)
13548 {
13549 //freeforall case, notify only one player of the removal
13550 ffaitem->is_looted = true;
13551 SendNotifyLootItemRemoved(lootSlot);
13552 }
13553 else
13554 {
13555 //not freeforall, notify everyone
13556 if (conditem)
13557 conditem->is_looted = true;
13558 loot->NotifyItemRemoved(lootSlot);
13559 }
13560 }
13561
13562 //if only one person is supposed to loot the item, then set it to looted
13563 if (!item->freeforall)
13564 item->is_looted = true;
13565
13566 --loot->unlootedCount;
13567
13568 SendNewItem(newitem, uint32(item->count), false, false, true);
13569 UpdateLootAchievements(item, loot);
13570
13571 // LootItem is being removed (looted) from the container, delete it from the DB.
13572 if (loot->containerGUID)
13573 sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
13574
13575 sScriptMgr->OnPlayerLootItem(this, newitem, item->count, this->GetLootGUID());
13576 }
13577 else
13578 {
13579 SendEquipError(msg, nullptr, nullptr, item->itemid);
13580 }
13581
13582 return item;
13583}
bool IsItem() const
Definition Object.h:225
void UpdateLootAchievements(LootItem *item, Loot *loot)
Definition PlayerUpdates.cpp:2169
void SendNotifyLootItemRemoved(uint8 lootSlot)
Definition Player.cpp:8196
bool is_blocked
Definition LootMgr.h:164
ObjectGuid rollWinnerGUID
Definition LootMgr.h:161
bool is_underthreshold
Definition LootMgr.h:166
bool AllowedForPlayer(Player const *player, ObjectGuid source) const
Definition LootMgr.cpp:417
uint32 itemIndex
Definition LootMgr.h:156
bool is_looted
Definition LootMgr.h:163
const AllowedLooterSet & GetAllowedLooters() const
Definition LootMgr.h:181
bool freeforall
Definition LootMgr.h:165
ObjectGuid sourceWorldObjectGUID
Definition LootMgr.h:330
void NotifyQuestItemRemoved(uint8 questIndex)
Definition LootMgr.cpp:804
QuestItemMap const & GetPlayerQuestItems() const
Definition LootMgr.h:316
void NotifyItemRemoved(uint8 lootIndex)
Definition LootMgr.cpp:773
Definition LootMgr.h:185
uint8 index
Definition LootMgr.h:186
bool is_looted
Definition LootMgr.h:187

References LootItem::AllowedForPlayer(), CanStoreNewItem(), Loot::containerGUID, LootItem::count, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_OK, LootItem::freeforall, LootItem::GetAllowedLooters(), GetGroup(), Object::GetGUID(), GetLootGUID(), Loot::GetPlayerQuestItems(), QuestItem::index, LootItem::is_blocked, LootItem::is_looted, QuestItem::is_looted, LootItem::is_underthreshold, Object::IsItem(), LootItem::itemid, LootItem::itemIndex, Loot::LootItemInSlot(), MASTER_LOOT, Loot::NotifyItemRemoved(), Loot::NotifyQuestItemRemoved(), NULL_BAG, NULL_SLOT, LootItem::randomPropertyId, LootItem::rollWinnerGUID, Loot::roundRobinPlayer, SendEquipError(), SendLootRelease(), SendNewItem(), SendNotifyLootItemRemoved(), sLootItemStorage, Loot::sourceWorldObjectGUID, sScriptMgr, StoreNewItem(), Loot::unlootedCount, and UpdateLootAchievements().

Referenced by Loot::FillNotNormalLootFor(), and WorldSession::HandleAutostoreLootItemOpcode().

◆ StoreNewItem() [1/2]

Item * Player::StoreNewItem ( ItemPosCountVec const &  pos,
uint32  item,
bool  update,
int32  randomPropertyId,
AllowedLooterSet allowedLooters 
)
2532{
2533 uint32 count = 0;
2534 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
2535 count += itr->count;
2536
2537 Item* pItem = Item::CreateItem(item, count, this, false, randomPropertyId);
2538 if (pItem)
2539 {
2540 // pussywizard: obtaining blue or better items saves to db
2541 if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
2542 if (pProto->Quality >= ITEM_QUALITY_RARE)
2544
2545 ItemAddedQuestCheck(item, count);
2548 pItem = StoreItem(dest, pItem, update);
2549
2550 if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound() && sWorld->getBoolConfig(CONFIG_SET_BOP_ITEM_TRADEABLE))
2551 {
2552 pItem->SetSoulboundTradeable(allowedLooters);
2554 AddTradeableItem(pItem);
2555
2556 // save data
2557 std::ostringstream ss;
2558 AllowedLooterSet::const_iterator itr = allowedLooters.begin();
2559 ss << (*itr).GetCounter();
2560 for (++itr; itr != allowedLooters.end(); ++itr)
2561 ss << ' ' << (*itr).GetCounter();
2562
2564 stmt->SetData(0, pItem->GetGUID().GetCounter());
2565 stmt->SetData(1, ss.str());
2566 CharacterDatabase.Execute(stmt);
2567 }
2568
2569 sScriptMgr->OnPlayerStoreNewItem(this, pItem, count);
2570 }
2571 return pItem;
2572}
@ CHAR_INS_ITEM_BOP_TRADE
Definition CharacterDatabase.h:122
@ ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM
Definition DBCEnums.h:150
@ ITEM_FIELD_CREATE_PLAYED_TIME
Definition UpdateFields.h:71
@ CONFIG_SET_BOP_ITEM_TRADEABLE
Definition WorldConfig.h:125

References ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, ADDITIONAL_SAVING_INVENTORY_AND_GOLD, AdditionalSavingAddMask(), AddTradeableItem(), CHAR_INS_ITEM_BOP_TRADE, CharacterDatabase, CONFIG_SET_BOP_ITEM_TRADEABLE, Item::CreateItem(), ObjectGuid::GetCounter(), Object::GetGUID(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), GetTotalPlayedTime(), Item::IsSoulBound(), ITEM_FIELD_CREATE_PLAYED_TIME, ITEM_QUALITY_RARE, ItemAddedQuestCheck(), PreparedStatementBase::SetData(), Item::SetSoulboundTradeable(), Object::SetUInt32Value(), sObjectMgr, sScriptMgr, StoreItem(), sWorld, and UpdateAchievementCriteria().

◆ StoreNewItem() [2/2]

◆ StoreNewItemInBestSlots()

bool Player::StoreNewItemInBestSlots ( uint32  item_id,
uint32  item_count 
)
707{
708 LOG_DEBUG("entities.player.items", "STORAGE: Creating initial item, itemId = {}, count = {}", titem_id, titem_amount);
709
710 // attempt equip by one
711 while (titem_amount > 0)
712 {
713 uint16 eDest;
714 InventoryResult msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false);
715 if (msg != EQUIP_ERR_OK)
716 break;
717
718 EquipNewItem(eDest, titem_id, true);
720 --titem_amount;
721 }
722
723 if (titem_amount == 0)
724 return true; // equipped
725
726 // attempt store
727 ItemPosCountVec sDest;
728 // store in main bag to simplify second pass (special bags can be not equipped yet at this moment)
729 InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount);
730 if (msg == EQUIP_ERR_OK)
731 {
732 StoreNewItem(sDest, titem_id, true);
733 return true; // stored
734 }
735
736 // item can't be added
737 LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(true), getClass(), msg);
738 return false;
739}

References AutoUnequipOffhandIfNeed(), CanEquipNewItem(), CanStoreNewItem(), EQUIP_ERR_OK, EquipNewItem(), Unit::getClass(), Unit::getRace(), INVENTORY_SLOT_BAG_0, LOG_DEBUG, LOG_ERROR, NULL_SLOT, and StoreNewItem().

Referenced by Create().

◆ StoreRaidMapDifficulty()

void Player::StoreRaidMapDifficulty ( )
inline

◆ SummonIfPossible()

void Player::SummonIfPossible ( bool  agree,
ObjectGuid  summoner_guid 
)
12388{
12389 if (!agree)
12390 {
12391 m_summon_expire = 0;
12392 return;
12393 }
12394
12395 // expire and auto declined
12396 if (m_summon_expire < GameTime::GetGameTime().count())
12397 return;
12398
12399 // drop flag at summon
12400 // this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag
12401 if (Battleground* bg = GetBattleground())
12402 bg->EventPlayerDroppedFlag(this);
12403
12404 m_summon_expire = 0;
12405
12407
12409}
@ ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS
Definition DBCEnums.h:220
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:245

References ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, ObjectAccessor::FindPlayer(), GetBattleground(), GameTime::GetGameTime(), Position::GetOrientation(), m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, TeleportTo(), and UpdateAchievementCriteria().

Referenced by WorldSession::HandleSummonResponseOpcode().

◆ SummonPet()

Pet * Player::SummonPet ( uint32  entry,
float  x,
float  y,
float  z,
float  ang,
PetType  petType,
Milliseconds  duration = 0s,
uint32  healthPct = 0 
)
8960{
8961 PetStable& petStable = GetOrInitPetStable();
8962
8963 Pet* pet = new Pet(this, petType);
8964
8965 if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry, 0, false, healthPct))
8966 {
8967 // Remove Demonic Sacrifice auras (known pet)
8969 for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
8970 {
8971 if ((*itr)->GetMiscValue() == 2228)
8972 {
8973 RemoveAurasDueToSpell((*itr)->GetId());
8974 itr = auraClassScripts.begin();
8975 }
8976 else
8977 ++itr;
8978 }
8979
8980 if (duration > 0s)
8981 pet->SetDuration(duration);
8982
8983 // Generate a new name for the newly summoned ghoul
8984 if (pet->IsPetGhoul())
8985 {
8986 std::string new_name = sObjectMgr->GeneratePetNameLocale(entry, GetSession()->GetSessionDbLocaleIndex());
8987 if (!new_name.empty())
8988 pet->SetName(new_name);
8989 }
8990
8991 return nullptr;
8992 }
8993
8994 // petentry == 0 for hunter "call pet" (current pet summoned if any)
8995 if (!entry)
8996 {
8997 delete pet;
8998 return nullptr;
8999 }
9000
9001 pet->Relocate(x, y, z, ang);
9002 if (!pet->IsPositionValid())
9003 {
9004 LOG_ERROR("misc", "Player::SummonPet: Pet ({}, Entry: {}) not summoned. Suggested coordinates aren't valid (X: {} Y: {})", pet->GetGUID().ToString(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
9005 delete pet;
9006 return nullptr;
9007 }
9008
9009 Map* map = GetMap();
9010 uint32 pet_number = sObjectMgr->GeneratePetNumber();
9011 if (!pet->Create(map->GenerateLowGuid<HighGuid::Pet>(), map, GetPhaseMask(), entry, pet_number))
9012 {
9013 LOG_ERROR("misc", "Player::SummonPet: No such creature entry {}", entry);
9014 delete pet;
9015 return nullptr;
9016 }
9017
9018 if (petType == SUMMON_PET && petStable.CurrentPet)
9020
9021 pet->SetCreatorGUID(GetGUID());
9022 pet->SetFaction(GetFaction());
9027
9028 SetMinion(pet, true);
9029
9030 if (petType == SUMMON_PET)
9031 {
9033 {
9034 pet->GetCharmInfo()->SetPetNumber(pet_number, true); // Show pet details tab (Shift+P) only for demons & undead
9035 }
9036 else
9037 {
9038 pet->GetCharmInfo()->SetPetNumber(pet_number, false);
9039 }
9040
9043 pet->SetFullHealth();
9045 pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped in this case
9046 }
9047
9048 map->AddToMap(pet->ToCreature(), true);
9049
9050 ASSERT(!petStable.CurrentPet && (petType != HUNTER_PET || !petStable.GetUnslottedHunterPet()));
9051 pet->FillPetInfo(&petStable.CurrentPet.emplace());
9052
9053 if (petType == SUMMON_PET)
9054 {
9055 pet->InitPetCreateSpells();
9056 pet->InitTalentForLevel();
9059
9060 // Remove Demonic Sacrifice auras (known pet)
9062 for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
9063 {
9064 if ((*itr)->GetMiscValue() == 2228)
9065 {
9066 RemoveAurasDueToSpell((*itr)->GetId());
9067 itr = auraClassScripts.begin();
9068 }
9069 else
9070 ++itr;
9071 }
9072 }
9073
9074 if (duration > 0s)
9075 pet->SetDuration(duration);
9076
9078 {
9081 }
9082
9083 return pet;
9084}
@ SUMMON_PET
Definition PetDefines.h:31
@ CREATURE_TYPE_UNDEAD
Definition SharedDefines.h:2633
@ CREATURE_TYPE_DEMON
Definition SharedDefines.h:2630
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175
@ UNIT_NPC_FLAG_NONE
Definition UnitDefines.h:314
@ UNIT_FIELD_PETEXPERIENCE
Definition UpdateFields.h:134
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition UpdateFields.h:133
@ UNIT_FIELD_PETNEXTLEVELEXP
Definition UpdateFields.h:135
bool InitStatsForLevel(uint8 level)
Definition Pet.cpp:1018
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:466
bool IsPetGhoul() const
Definition TemporarySummon.h:85
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition Pet.cpp:2477
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number)
Definition Pet.cpp:2321
void SetDuration(Milliseconds dur)
Definition Pet.h:90
void InitPetCreateSpells()
Definition Pet.cpp:2052
PetStable & GetOrInitPetStable()
Definition Player.cpp:15550
float GetHealthPct() const
Definition Unit.h:1033
void ReplaceAllNpcFlags(NPCFlags flags)
Definition Unit.h:721
void SetName(std::string const &newname)
Definition Object.h:515
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition CharmInfo.cpp:240
uint32 type
Definition CreatureData.h:222

References Map::AddToMap(), ASSERT, Pet::Create(), CREATURE_TYPE_DEMON, CREATURE_TYPE_UNDEAD, PetStable::CurrentPet, CreatureTemplate::family, Pet::FillPetInfo(), WorldObject::FindMap(), Map::GenerateLowGuid(), Unit::GetAuraEffectsByType(), Unit::GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), Unit::GetFaction(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGUID(), Unit::GetHealthPct(), Unit::GetLevel(), WorldObject::GetMap(), Unit::GetMaxPower(), GetOrInitPetStable(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), GetSession(), PetStable::GetUnslottedHunterPet(), HUNTER_PET, Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Pet::InitTalentForLevel(), Minion::IsPetGhoul(), Position::IsPositionValid(), Pet::LoadPetFromDB(), LOG_ERROR, NeedSendSpectatorData(), Pet, PET_SAVE_AS_CURRENT, PET_SAVE_NOT_IN_SLOT, PetSpellInitialize(), POWER_MANA, Position::Relocate(), Unit::RemoveAurasDueToSpell(), RemovePet(), Unit::ReplaceAllNpcFlags(), Pet::SavePetToDB(), ArenaSpectator::SendCommand_UInt32Value(), Unit::SetCreatorGUID(), Pet::SetDuration(), Unit::SetFaction(), Unit::SetFullHealth(), Unit::SetMinion(), WorldObject::SetName(), CharmInfo::SetPetNumber(), Unit::SetPower(), Unit::setPowerType(), Unit::SetUInt32Value(), sObjectMgr, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SUMMON_PET, Object::ToCreature(), ObjectGuid::ToString(), CreatureTemplate::type, UNIT_FIELD_BYTES_1, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FIELD_PETEXPERIENCE, UNIT_FIELD_PETNEXTLEVELEXP, and UNIT_NPC_FLAG_NONE.

Referenced by Spell::EffectResurrectPet(), and Spell::EffectSummonPet().

◆ SwapItem()

void Player::SwapItem ( uint16  src,
uint16  dst 
)
3537{
3538 uint8 srcbag = src >> 8;
3539 uint8 srcslot = src & 255;
3540
3541 uint8 dstbag = dst >> 8;
3542 uint8 dstslot = dst & 255;
3543
3544 Item* pSrcItem = GetItemByPos(srcbag, srcslot);
3545 Item* pDstItem = GetItemByPos(dstbag, dstslot);
3546
3547 if (!pSrcItem)
3548 return;
3549
3550 LOG_DEBUG("entities.player.items", "STORAGE: SwapItem bag = {}, slot = {}, item = {}", dstbag, dstslot, pSrcItem->GetEntry());
3551
3552 if (!IsAlive())
3553 {
3554 SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem);
3555 return;
3556 }
3557
3558 // SRC checks
3559
3560 if (GetLootGUID() == pSrcItem->GetGUID()) // prevent swap looting item
3561 {
3562 //best error message found for attempting to swap while looting
3563 SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, nullptr);
3564 return;
3565 }
3566
3567 // check unequip potability for equipped items and bank bags
3568 if (IsEquipmentPos(src) || IsBagPos(src))
3569 {
3570 // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
3571 InventoryResult msg = CanUnequipItem(src, !IsBagPos(src) || IsBagPos(dst) || (pDstItem && pDstItem->ToBag() && pDstItem->ToBag()->IsEmpty()));
3572 if (msg != EQUIP_ERR_OK)
3573 {
3574 SendEquipError(msg, pSrcItem, pDstItem);
3575 return;
3576 }
3577 }
3578
3579 // anti-wpe
3580 if (pSrcItem->IsBag() && pSrcItem->IsNotEmptyBag() && !IsBagPos(dst))
3581 {
3583 return;
3584 }
3585
3586 // prevent put equipped/bank bag in self
3587 if (IsBagPos(src) && srcslot == dstbag)
3588 {
3590 return;
3591 }
3592
3593 // prevent equipping bag in the same slot from its inside
3594 if (IsBagPos(dst) && srcbag == dstslot)
3595 {
3597 return;
3598 }
3599
3600 // DST checks
3601
3602 if (pDstItem)
3603 {
3604 // Xinef: Removed next loot generated check
3605 if (pDstItem->GetGUID() == GetLootGUID()) // prevent swap looting item
3606 {
3607 //best error message found for attempting to swap while looting
3608 SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, nullptr);
3609 return;
3610 }
3611
3612 // check unequip potability for equipped items and bank bags
3613 if (IsEquipmentPos(dst) || IsBagPos(dst))
3614 {
3615 // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
3616 InventoryResult msg = CanUnequipItem(dst, !IsBagPos(dst) || IsBagPos(src) || (pSrcItem->ToBag() && pSrcItem->ToBag()->IsEmpty()));
3617 if (msg != EQUIP_ERR_OK)
3618 {
3619 SendEquipError(msg, pSrcItem, pDstItem);
3620 return;
3621 }
3622 }
3623 }
3624
3625 // NOW this is or item move (swap with empty), or swap with another item (including bags in bag possitions)
3626 // or swap empty bag with another empty or not empty bag (with items exchange)
3627
3628 // Move case
3629 if (!pDstItem)
3630 {
3631 if (IsInventoryPos(dst))
3632 {
3633 ItemPosCountVec dest;
3634 InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false);
3635 if (msg != EQUIP_ERR_OK)
3636 {
3637 SendEquipError(msg, pSrcItem, nullptr);
3638 return;
3639 }
3640
3641 RemoveItem(srcbag, srcslot, true);
3642 StoreItem(dest, pSrcItem, true);
3644 if (IsBankPos(src))
3645 ItemAddedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
3646 }
3647 else if (IsBankPos(dst))
3648 {
3649 ItemPosCountVec dest;
3650 InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false);
3651 if (msg != EQUIP_ERR_OK)
3652 {
3653 SendEquipError(msg, pSrcItem, nullptr);
3654 return;
3655 }
3656
3657 RemoveItem(srcbag, srcslot, true);
3658 BankItem(dest, pSrcItem, true);
3660 ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
3661 }
3662 else if (IsEquipmentPos(dst))
3663 {
3664 uint16 dest;
3665 InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false);
3666 if (msg != EQUIP_ERR_OK)
3667 {
3668 SendEquipError(msg, pSrcItem, nullptr);
3669 return;
3670 }
3671
3672 RemoveItem(srcbag, srcslot, true);
3673 EquipItem(dest, pSrcItem, true);
3675 }
3676
3677 return;
3678 }
3679
3680 // attempt merge to / fill target item
3681 if (!pSrcItem->IsBag() && !pDstItem->IsBag())
3682 {
3683 InventoryResult msg;
3684 ItemPosCountVec sDest;
3685 uint16 eDest = 0;
3686 if (IsInventoryPos(dst))
3687 msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false);
3688 else if (IsBankPos(dst))
3689 msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, false);
3690 else if (IsEquipmentPos(dst))
3691 msg = CanEquipItem(dstslot, eDest, pSrcItem, false);
3692 else
3693 return;
3694
3695 // can be merge/fill
3696 if (msg == EQUIP_ERR_OK)
3697 {
3698 if (pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetTemplate()->GetMaxStackSize())
3699 {
3700 RemoveItem(srcbag, srcslot, true);
3701
3702 if (IsInventoryPos(dst))
3703 StoreItem(sDest, pSrcItem, true);
3704 else if (IsBankPos(dst))
3705 BankItem(sDest, pSrcItem, true);
3706 else if (IsEquipmentPos(dst))
3707 {
3708 EquipItem(eDest, pSrcItem, true);
3710 }
3711 }
3712 else
3713 {
3714 pSrcItem->SetCount(pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetTemplate()->GetMaxStackSize());
3715 pDstItem->SetCount(pSrcItem->GetTemplate()->GetMaxStackSize());
3716 pSrcItem->SetState(ITEM_CHANGED, this);
3717 pDstItem->SetState(ITEM_CHANGED, this);
3718 if (IsInWorld())
3719 {
3720 pSrcItem->SendUpdateToPlayer(this);
3721 pDstItem->SendUpdateToPlayer(this);
3722 }
3723 }
3724 SendRefundInfo(pDstItem);
3725 return;
3726 }
3727 }
3728
3729 // Remove item enchantments for now and restore it later
3730 // Needed for swap sanity checks
3731 ApplyEnchantment(pSrcItem, false);
3732 if (pDstItem)
3733 {
3734 ApplyEnchantment(pDstItem, false);
3735 }
3736
3737 // impossible merge/fill, do real swap
3739
3740 // check src->dest move possibility
3741 ItemPosCountVec sDest;
3742 uint16 eDest = 0;
3743 if (IsInventoryPos(dst))
3744 msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, true);
3745 else if (IsBankPos(dst))
3746 msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, true);
3747 else if (IsEquipmentPos(dst))
3748 {
3749 msg = CanEquipItem(dstslot, eDest, pSrcItem, true);
3750 if (msg == EQUIP_ERR_OK)
3751 msg = CanUnequipItem(eDest, true);
3752 }
3753
3754 if (msg != EQUIP_ERR_OK)
3755 {
3756 // Restore enchantments
3757 ApplyEnchantment(pSrcItem, true);
3758 if (pDstItem)
3759 {
3760 ApplyEnchantment(pDstItem, true);
3761 }
3762
3763 SendEquipError(msg, pSrcItem, pDstItem);
3764 return;
3765 }
3766
3767 // check dest->src move possibility
3768 ItemPosCountVec sDest2;
3769 uint16 eDest2 = 0;
3770 if (IsInventoryPos(src))
3771 msg = CanStoreItem(srcbag, srcslot, sDest2, pDstItem, true);
3772 else if (IsBankPos(src))
3773 msg = CanBankItem(srcbag, srcslot, sDest2, pDstItem, true);
3774 else if (IsEquipmentPos(src))
3775 {
3776 msg = CanEquipItem(srcslot, eDest2, pDstItem, true);
3777 if (msg == EQUIP_ERR_OK)
3778 msg = CanUnequipItem(eDest2, true);
3779 }
3780
3781 if (msg != EQUIP_ERR_OK)
3782 {
3783 // Restore enchantments
3784 ApplyEnchantment(pSrcItem, true);
3785 if (pDstItem)
3786 {
3787 ApplyEnchantment(pDstItem, true);
3788 }
3789
3790 SendEquipError(msg, pDstItem, pSrcItem);
3791 return;
3792 }
3793
3794 // Restore enchantments
3795 ApplyEnchantment(pSrcItem, true);
3796 if (pDstItem)
3797 {
3798 ApplyEnchantment(pDstItem, true);
3799 }
3800
3801 // Check bag swap with item exchange (one from empty in not bag possition (equipped (not possible in fact) or store)
3802 if (Bag* srcBag = pSrcItem->ToBag())
3803 {
3804 if (Bag* dstBag = pDstItem->ToBag())
3805 {
3806 Bag* emptyBag = nullptr;
3807 Bag* fullBag = nullptr;
3808 if (srcBag->IsEmpty() && !IsBagPos(src))
3809 {
3810 emptyBag = srcBag;
3811 fullBag = dstBag;
3812 }
3813 else if (dstBag->IsEmpty() && !IsBagPos(dst))
3814 {
3815 emptyBag = dstBag;
3816 fullBag = srcBag;
3817 }
3818
3819 // bag swap (with items exchange) case
3820 if (emptyBag && fullBag)
3821 {
3822 ItemTemplate const* emptyProto = emptyBag->GetTemplate();
3823
3824 uint32 count = 0;
3825
3826 for (uint32 i = 0; i < fullBag->GetBagSize(); ++i)
3827 {
3828 Item* bagItem = fullBag->GetItemByPos(i);
3829 if (!bagItem)
3830 continue;
3831
3832 ItemTemplate const* bagItemProto = bagItem->GetTemplate();
3833 if (!bagItemProto || !ItemCanGoIntoBag(bagItemProto, emptyProto))
3834 {
3835 // one from items not go to empty target bag
3837 return;
3838 }
3839
3840 ++count;
3841 }
3842
3843 if (count > emptyBag->GetBagSize())
3844 {
3845 // too small targeted bag
3847 return;
3848 }
3849
3850 // Items swap
3851 count = 0; // will pos in new bag
3852 for (uint32 i = 0; i < fullBag->GetBagSize(); ++i)
3853 {
3854 Item* bagItem = fullBag->GetItemByPos(i);
3855 if (!bagItem)
3856 continue;
3857
3858 fullBag->RemoveItem(i, true);
3859 emptyBag->StoreItem(count, bagItem, true);
3860 bagItem->SetState(ITEM_CHANGED, this);
3861
3862 ++count;
3863 }
3864 }
3865 }
3866 }
3867
3868 // now do moves, remove...
3869 RemoveItem(dstbag, dstslot, false, true);
3870 RemoveItem(srcbag, srcslot, false, true);
3871
3872 // add to dest
3873 if (IsInventoryPos(dst))
3874 StoreItem(sDest, pSrcItem, true);
3875 else if (IsBankPos(dst))
3876 BankItem(sDest, pSrcItem, true);
3877 else if (IsEquipmentPos(dst))
3878 EquipItem(eDest, pSrcItem, true);
3879
3880 // add to src
3881 if (IsInventoryPos(src))
3882 StoreItem(sDest2, pDstItem, true);
3883 else if (IsBankPos(src))
3884 BankItem(sDest2, pDstItem, true);
3885 else if (IsEquipmentPos(src))
3886 EquipItem(eDest2, pDstItem, true);
3887
3888 // Xinef: Call this here after all needed items are equipped
3890
3891 // if player is moving bags and is looting an item inside this bag
3892 // release the loot
3893 if (GetLootGUID())
3894 {
3895 bool released = false;
3896 if (IsBagPos(src))
3897 {
3898 Bag* bag = pSrcItem->ToBag();
3899 for (uint32 i = 0; i < bag->GetBagSize(); ++i)
3900 {
3901 if (Item* bagItem = bag->GetItemByPos(i))
3902 {
3903 // Xinef: Removed next loot generated check
3904 if (bagItem->GetGUID() == GetLootGUID())
3905 {
3907 released = true; // so we don't need to look at dstBag
3908 break;
3909 }
3910 }
3911 }
3912 }
3913
3914 if (!released && IsBagPos(dst))
3915 {
3916 Bag* bag = pDstItem->ToBag();
3917 for (uint32 i = 0; i < bag->GetBagSize(); ++i)
3918 {
3919 if (Item* bagItem = bag->GetItemByPos(i))
3920 {
3921 // Xinef: Removed next loot generated check
3922 if (bagItem->GetGUID() == GetLootGUID())
3923 {
3925 released = true; // not realy needed here
3926 break;
3927 }
3928 }
3929 }
3930 }
3931 }
3932
3934}
bool IsEmpty() const
Definition Bag.cpp:179
Item * GetItemByPos(uint8 slot) const
Definition Bag.cpp:235
void RemoveItem(uint8 slot, bool update)
Definition Bag.cpp:143
void SendRefundInfo(Item *item)
Definition Player.cpp:15487

References ApplyEnchantment(), AutoUnequipOffhandIfNeed(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), CanUnequipItem(), WorldSession::DoLootRelease(), EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_DEAD, EquipItem(), Bag::GetBagSize(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), Bag::GetItemByPos(), GetLootGUID(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), Unit::IsAlive(), Item::IsBag(), IsBagPos(), IsBankPos(), Bag::IsEmpty(), IsEquipmentPos(), IsInventoryPos(), Object::IsInWorld(), Item::IsNotEmptyBag(), ITEM_CHANGED, ItemAddedQuestCheck(), ItemCanGoIntoBag(), ItemRemovedQuestCheck(), LOG_DEBUG, m_session, RemoveItem(), Bag::RemoveItem(), RemoveItemDependentAurasAndCasts(), SendEquipError(), SendRefundInfo(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), StoreItem(), Bag::StoreItem(), Item::ToBag(), and UpdateTitansGrip().

Referenced by WorldSession::HandleAutoEquipItemSlotOpcode(), WorldSession::HandleEquipmentSetUse(), item_commandscript::HandleItemMoveCommand(), WorldSession::HandleSwapInvItemOpcode(), and WorldSession::HandleSwapItem().

◆ SwapQuestSlot()

void Player::SwapQuestSlot ( uint16  slot1,
uint16  slot2 
)
inline
1522 {
1523 for (int i = 0; i < MAX_QUEST_OFFSET; ++i)
1524 {
1527
1530 }
1531 }

References Object::GetUInt32Value(), MAX_QUEST_OFFSET, PLAYER_QUEST_LOG_1_1, and Unit::SetUInt32Value().

Referenced by WorldSession::HandleQuestLogSwapQuest().

◆ TakeQuestSourceItem()

bool Player::TakeQuestSourceItem ( uint32  questId,
bool  msg 
)
1364{
1365 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1366 if (quest)
1367 {
1368 uint32 srcItemId = quest->GetSrcItemId();
1369 ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
1370
1371 if (srcItemId > 0)
1372 {
1373 uint32 count = quest->GetSrcItemCount();
1374 if (count <= 0)
1375 count = 1;
1376
1377 // exist two cases when destroy source quest item not possible:
1378 // a) non un-equippable item (equipped non-empty bag, for example)
1379 // b) when quest is started from an item and item also is needed in
1380 // the end as RequiredItemId
1381 InventoryResult res = CanUnequipItems(srcItemId, count);
1382 if (res != EQUIP_ERR_OK)
1383 {
1384 if (msg)
1385 SendEquipError(res, nullptr, nullptr, srcItemId);
1386 return false;
1387 }
1388
1389 bool destroyItem = true;
1390 for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
1391 if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
1392 destroyItem = false;
1393
1394 if (destroyItem)
1395 DestroyItemCount(srcItemId, count, true, true);
1396 }
1397 }
1398
1399 return true;
1400}
InventoryResult CanUnequipItems(uint32 item, uint32 count) const
Definition PlayerStorage.cpp:273
uint32 GetSrcItemCount() const
Definition QuestDef.h:259
uint32 GetSrcItemId() const
Definition QuestDef.h:258
uint32 StartQuest
Definition ItemTemplate.h:668

References CanUnequipItems(), DestroyItemCount(), EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), QUEST_ITEM_OBJECTIVES_COUNT, Quest::RequiredItemId, SendEquipError(), sObjectMgr, and ItemTemplate::StartQuest.

Referenced by Spell::EffectQuestClear(), and WorldSession::HandleQuestLogRemoveQuest().

◆ TalkedToCreature()

void Player::TalkedToCreature ( uint32  entry,
ObjectGuid  guid 
)
2113{
2114 uint16 addTalkCount = 1;
2115 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2116 {
2117 uint32 questid = GetQuestSlotQuestId(i);
2118 if (!questid)
2119 continue;
2120
2121 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
2122 if (!qInfo)
2123 continue;
2124
2125 QuestStatusData& q_status = m_QuestStatus[questid];
2126
2127 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2128 {
2130 {
2131 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
2132 {
2133 // skip Gameobject objectives
2134 if (qInfo->RequiredNpcOrGo[j] < 0)
2135 continue;
2136
2137 uint32 reqTarget = 0;
2138
2139 if (qInfo->RequiredNpcOrGo[j] > 0) // creature activate objectives
2140 // checked at quest_template loading
2141 reqTarget = qInfo->RequiredNpcOrGo[j];
2142 else
2143 continue;
2144
2145 if (reqTarget == entry)
2146 {
2147 uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j];
2148 uint16 curTalkCount = q_status.CreatureOrGOCount[j];
2149 if (curTalkCount < reqTalkCount)
2150 {
2151 q_status.CreatureOrGOCount[j] = curTalkCount + addTalkCount;
2152
2153 m_QuestStatusSave[questid] = true;
2154
2155 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curTalkCount, addTalkCount);
2156 }
2157 if (CanCompleteQuest(questid))
2158 CompleteQuest(questid);
2159 else
2161
2162 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
2163 continue;
2164 }
2165 }
2166 }
2167 }
2168 }
2169}

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, GetQuestSlotQuestId(), Quest::HasSpecialFlag(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, and QuestStatusData::Status.

Referenced by npc_aged_dying_ancient_kodo::OnGossipHello(), brann_bronzebeard::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_razael_and_lyana::OnGossipSelect(), and npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI().

◆ TeamIdForRace()

TeamId Player::TeamIdForRace ( uint8  race)
static
5864{
5865 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race))
5866 {
5867 switch (rEntry->TeamID)
5868 {
5869 case 1:
5870 return TEAM_HORDE;
5871 case 7:
5872 return TEAM_ALLIANCE;
5873 }
5874 LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
5875 }
5876 else
5877 LOG_ERROR("entities.player", "Race ({}) not found in DBC: wrong DBC files?", uint32(race));
5878
5879 return TEAM_ALLIANCE;
5880}

References LOG_ERROR, sChrRacesStore, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by CharacterCache::GetCharacterTeamByGuid(), Unit::GetModelForForm(), GetTeamId(), WorldSession::HandleAddFriendOpcode(), WorldSession::HandleCalendarEventInvite(), WorldSession::HandleCharCreateOpcode(), WorldSession::HandleCharFactionOrRaceChangeCallback(), WorldSession::HandleSendMail(), misc_commandscript::HandleSkirmishCommand(), PlayerTaxi::InitTaxiNodesForLevel(), Channel::KickOrBan(), AchievementMgr::LoadFromDB(), and SetFactionForRace().

◆ TeleportTo() [1/2]

bool Player::TeleportTo ( uint32  mapid,
float  x,
float  y,
float  z,
float  orientation,
uint32  options = 0,
Unit target = nullptr,
bool  newInstance = false 
)
1346{
1347 if (!MapMgr::IsValidMapCoord(mapid, x, y, z, orientation))
1348 {
1349 LOG_ERROR("entities.player", "TeleportTo: invalid map ({}) or invalid coordinates (X: {}, Y: {}, Z: {}, O: {}) given when teleporting player ({}, name: {}, map: {}, X: {}, Y: {}, Z: {}, O: {}).",
1350 mapid, x, y, z, orientation, GetGUID().ToString(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
1351 return false;
1352 }
1353
1354 if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
1355 {
1356 LOG_ERROR("entities.player", "Player ({}, name: {}) tried to enter a forbidden map {}", GetGUID().ToString(), GetName(), mapid);
1358 return false;
1359 }
1360
1361 // preparing unsummon pet if lost (we must get pet before teleportation or will not find it later)
1362 Pet* pet = GetPet();
1363
1364 MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
1365
1366 // don't let enter battlegrounds without assigned battleground id (for example through areatrigger)...
1367 if (!InBattleground() && mEntry->IsBattlegroundOrArena())
1368 return false;
1369
1370 // pussywizard: arena spectator, prevent teleporting from arena to instance/etc
1371 if (GetMapId() != mapid && IsSpectator() && mEntry->Instanceable())
1372 {
1374 return false;
1375 }
1376
1377 // client without expansion support
1378 if (GetSession()->Expansion() < mEntry->Expansion())
1379 {
1380 LOG_DEBUG("maps", "Player {} using client without required expansion tried teleport to non accessible map {}", GetName(), mapid);
1381
1382 if (GetTransport())
1383 {
1385 m_transport = nullptr;
1388 RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :)
1389 }
1390
1392
1393 return false; // normal client can't teleport to this map...
1394 }
1395 else
1396 LOG_DEBUG("maps", "Player {} is being teleported to map {}", GetName(), mapid);
1397
1398 // xinef: do this here in case teleport failed in above checks
1399 if (!(options & TELE_TO_NOT_LEAVE_TAXI) && IsInFlight())
1400 {
1403 }
1404
1405 if (!(options & TELE_TO_NOT_LEAVE_VEHICLE) && m_vehicle)
1406 ExitVehicle();
1407
1408 // reset movement flags at teleport, because player will continue move with these flags after teleport
1410 DisableSpline();
1411
1412 // Xinef: Remove all movement imparing effects auras, skip small teleport like blink
1413 if (mapid != GetMapId() || GetDistance2d(x, y) > 100)
1414 {
1419 // remove auras that should be removed when being teleported
1421 }
1422
1423 if (m_transport)
1424 {
1425 if (options & TELE_TO_NOT_LEAVE_TRANSPORT)
1427 else
1428 {
1430 m_transport = nullptr;
1433 }
1434 }
1435
1436 // The player was ported to another map and loses the duel immediately.
1437 // We have to perform this check before the teleport, otherwise the
1438 // ObjectAccessor won't find the flag.
1441
1442 if (!sScriptMgr->OnPlayerBeforeTeleport(this, mapid, x, y, z, orientation, options, target))
1443 return false;
1444
1445 if (GetMapId() == mapid && !newInstance)
1446 {
1447 //lets reset far teleport flag if it wasn't reset during chained teleports
1449
1450 SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one
1451 //if teleport spell is casted in Unit::Update() func
1452 //then we need to delay it until update process will be finished
1453 if (MustDelayTeleport())
1454 {
1457 //lets save teleport destination for player
1458 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1459 teleportStore_options = options;
1460 return true;
1461 }
1462
1463 if (options & TELE_TO_WITH_PET)
1465
1466 if (!(options & TELE_TO_NOT_UNSUMMON_PET))
1467 {
1468 //same map, only remove pet if out of range for new position
1469 if (pet && !pet->IsWithinDist3d(x, y, z, GetMap()->GetVisibilityRange()))
1471 }
1472
1473 if (!(options & TELE_TO_NOT_LEAVE_COMBAT))
1474 CombatStop();
1475
1476 // this will be used instead of the current location in SaveToDB
1477 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1479
1480 // code for finish transfer called in WorldSession::HandleMovementOpcodes()
1481 // at client packet MSG_MOVE_TELEPORT_ACK
1483 // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
1484 if (!GetSession()->PlayerLogout())
1485 {
1486 SetCanTeleport(true);
1487 Position oldPos = GetPosition();
1488 Relocate(x, y, z, orientation);
1490 SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place
1491 }
1492 }
1493 else
1494 {
1496 {
1498 return false;
1499 }
1500
1501 // far teleport to another map
1502 Map* oldmap = IsInWorld() ? GetMap() : nullptr;
1503 // check if we can enter before stopping combat / removing pet / totems / interrupting spells
1504
1505 // Check enter rights before map getting to avoid creating instance copy for player
1506 // this check not dependent from map instance copy and same for all instance copies of selected map
1507 if (!(options & TELE_TO_GM_MODE) && sMapMgr->PlayerCannotEnter(mapid, this, false))
1508 return false;
1509
1510 // if PlayerCannotEnter -> CanEnter: checked above
1511 {
1512 //lets reset near teleport flag if it wasn't reset during chained teleports
1514
1515 SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one
1516 //if teleport spell is casted in Unit::Update() func
1517 //then we need to delay it until update process will be finished
1518 if (MustDelayTeleport())
1519 {
1522 //lets save teleport destination for player
1523 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1524 teleportStore_options = options;
1525 return true;
1526 }
1527
1529
1530 CombatStop();
1531
1532 // remove arena spell coldowns/buffs now to also remove pet's cooldowns before it's temporarily unsummoned
1534 {
1535 // KEEP THIS ORDER!
1537 if (pet)
1538 pet->RemoveArenaAuras();
1539
1541 }
1542
1543 // remove pet on map change
1544 if (pet)
1546
1547 // remove all dyn objects
1549
1550 // stop spellcasting
1551 // not attempt interrupt teleportation spell at caster teleport
1552 if (!(options & TELE_TO_SPELL))
1553 if (IsNonMeleeSpellCast(true))
1555
1556 //remove auras before removing from map...
1558
1559 if (!GetSession()->PlayerLogout())
1560 {
1561 // send transfer packets
1562 WorldPacket data(SMSG_TRANSFER_PENDING, 4 + 4 + 4);
1563 data << uint32(mapid);
1564 if (m_transport)
1565 data << m_transport->GetEntry() << GetMapId();
1566
1567 GetSession()->SendPacket(&data);
1568 }
1569
1570 // remove from old map now
1571 if (oldmap)
1572 oldmap->RemovePlayerFromMap(this, false);
1573
1574 // xinef: do this before setting fall information!
1575 if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena()) && !m_transport)
1576 {
1578 if (!auras.empty())
1579 {
1580 SetMountBlockId((*auras.begin())->GetId());
1582 }
1583 }
1584
1585 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1587 // if the player is saved before worldportack (at logout for example)
1588 // this will be used instead of the current location in SaveToDB
1589
1590 if (!GetSession()->PlayerLogout())
1591 {
1592 SetCanTeleport(true);
1593 WorldPacket data(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4);
1594 data << uint32(mapid);
1595 if (m_transport)
1597 else
1599
1600 GetSession()->SendPacket(&data);
1602 }
1603
1604 // move packet sent by client always after far teleport
1605 // code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
1607 }
1608 }
1609 return true;
1610}
@ TELE_TO_WITH_PET
Definition Player.h:834
@ TELE_TO_NOT_LEAVE_TAXI
Definition Player.h:835
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition Player.h:833
@ TELE_TO_SPELL
Definition Player.h:832
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:830
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:831
@ TELE_TO_GM_MODE
Definition Player.h:828
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:829
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition Player.h:805
@ SPELL_AURA_MOD_CONFUSE
Definition SpellAuraDefines.h:68
@ AURA_INTERRUPT_FLAG_TELEPORTED
Definition SpellDefines.h:65
@ AURA_INTERRUPT_FLAG_MOVE
Definition SpellDefines.h:46
@ AURA_INTERRUPT_FLAG_TURNING
Definition SpellDefines.h:47
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition UnitDefines.h:414
@ CLASS_CONTEXT_TELEPORT
Definition UnitDefines.h:228
virtual void RemovePlayerFromMap(Player *, bool)
Definition Map.cpp:628
bool HasPendingSpectatorForBG(uint32 bgInstanceId) const
Definition Player.h:2596
void SendTeleportAckPacket()
Definition Player.cpp:1336
void SetSelection(ObjectGuid guid)
Used for serverside target changes, does not apply to players.
Definition Player.cpp:11524
void SendSavedInstances()
Definition PlayerStorage.cpp:6571
void SetSemaphoreTeleportNear(time_t tm)
Definition Player.h:2111
void SetHasDelayedTeleport(bool setting)
Definition Player.h:2969
void SetSemaphoreTeleportFar(time_t tm)
Definition Player.h:2112
bool MustDelayTeleport() const
Definition Player.h:2966
void CleanupAfterTaxiFlight()
Definition Player.cpp:10419
void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns=false)
Definition Player.cpp:3564
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
uint32 GetUnitMovementFlags() const
Definition Unit.h:730
Vehicle * m_vehicle
Definition Unit.h:2111
void SendTeleportPacket(Position &pos)
Definition Unit.cpp:19827
void SetUnitMovementFlags(uint32 f)
Definition Unit.h:731
void RemoveAllDynObjects()
Definition Unit.cpp:6250
void RemoveArenaAuras()
Definition Unit.cpp:5391
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition Object.cpp:1263
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1231
@ SMSG_NEW_WORLD
Definition Opcodes.h:92
@ SMSG_TRANSFER_PENDING
Definition Opcodes.h:93
bool IsBattleArena() const
Definition DBCStructure.h:1357
Position GetPosition() const
Definition Position.h:147
Position::PositionXYZOStreamer PositionXYZOStream()
Definition Position.h:154

References Unit::AddUnitMovementFlag(), AURA_INTERRUPT_FLAG_CHANGE_MAP, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TELEPORTED, AURA_INTERRUPT_FLAG_TURNING, CLASS_CONTEXT_TELEPORT, CLASS_DEATH_KNIGHT, CleanupAfterTaxiFlight(), Unit::CombatStop(), DISABLE_TYPE_MAP, Unit::DisableSpline(), duel, DUEL_FLED, DuelComplete(), ObjectGuid::Empty, Unit::ExitVehicle(), MapEntry::Expansion(), Unit::GetAuraEffectsByType(), GetBattlegroundId(), WorldObject::GetDistance2d(), Object::GetEntry(), Unit::GetGameObject(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGuidValue(), WorldObject::GetMap(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), WorldObject::GetName(), Position::GetOrientation(), GetPet(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), WorldObject::GetTransport(), Unit::GetUnitMovementFlags(), WorldObject::GetVisibilityRange(), HasPendingSpectatorForBG(), HasSpell(), InBattleground(), MapEntry::Instanceable(), Unit::InterruptNonMeleeSpells(), MapEntry::IsBattleArena(), MapEntry::IsBattlegroundOrArena(), IsClass(), IsGameMaster(), Unit::IsInFlight(), Object::IsInWorld(), Unit::IsMounted(), Unit::IsNonMeleeSpellCast(), AccountMgr::IsPlayerAccount(), IsSpectator(), MapMgr::IsValidMapCoord(), WorldObject::IsWithinDist3d(), LOG_DEBUG, LOG_ERROR, WorldObject::m_movementInfo, WorldObject::m_transport, Unit::m_vehicle, MAP_EBON_HOLD, MotionMaster::MovementExpired(), MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE, MOVEMENTFLAG_ONTRANSPORT, MustDelayTeleport(), PLAYER_DUEL_ARBITER, MovementInfo::TransportInfo::pos, Position::PositionXYZOStream(), Position::Relocate(), Unit::RemoveAllDynObjects(), Unit::RemoveArenaAuras(), RemoveArenaSpellCooldowns(), Unit::RemoveAurasByType(), Unit::RemoveAurasWithInterruptFlags(), MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), Map::RemovePlayerFromMap(), RepopAtGraveyard(), MovementInfo::TransportInfo::Reset(), sDisableMgr, WorldSession::SendPacket(), SendSavedInstances(), SendTeleportAckPacket(), Unit::SendTeleportPacket(), SendTransferAborted(), SetCanTeleport(), SetFallInformation(), SetHasDelayedTeleport(), SetMountBlockId(), SetSelection(), SetSemaphoreTeleportFar(), SetSemaphoreTeleportNear(), Unit::SetUnitMovementFlags(), sMapMgr, sMapStore, SMSG_NEW_WORLD, SMSG_TRANSFER_PENDING, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_MOUNTED, sScriptMgr, TELE_TO_GM_MODE, TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TAXI, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, teleportStore_dest, teleportStore_options, Position::ToString(), TRANSFER_ABORT_INSUF_EXPAN_LVL, TRANSFER_ABORT_MAP_NOT_ALLOWED, TRANSFER_ABORT_UNIQUE_MESSAGE, MovementInfo::transport, and UnsummonPetTemporaryIfAny().

Referenced by ActivateTaxiPathTo(), BattlegroundSA::CaptureGraveyard(), BattlegroundSA::DefendersPortalTeleport(), MotionTransport::DelayedTeleportTransport(), BattlegroundIC::DoAction(), go_commandscript::DoTeleport(), Spell::EffectTeleportUnits(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleWorldTeleportOpcode(), Unit::NearTeleportTo(), npc_wg_spirit_guide::OnGossipSelect(), BattlefieldWG::OnPlayerJoinWar(), lfg::LFGPlayerScript::OnPlayerMapChanged(), at_orb_of_command::OnTrigger(), at_icc_saurfang_portal::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_last_rites::OnTrigger(), Battlefield::PlayerAskToLeave(), BfGraveyard::RelocateDeadPlayers(), Battleground::RelocateDeadPlayers(), Map::RemoveAllPlayers(), RepopAtGraveyard(), ResurectUsingRequestData(), WorldSession::SendSpiritResurrect(), BattlegroundMgr::SendToBattleground(), SummonIfPossible(), lfg::LFGMgr::TeleportPlayer(), GmTicket::TeleportTo(), TeleportTo(), BattlegroundSA::TeleportToEntrancePosition(), TeleportToEntryPoint(), Update(), and GameObject::Use().

◆ TeleportTo() [2/2]

bool Player::TeleportTo ( WorldLocation const &  loc,
uint32  options = 0,
Unit target = nullptr 
)
inline
1111 {
1112 return TeleportTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), options, target);
1113 }

References WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and TeleportTo().

◆ TeleportToEntryPoint()

◆ TextEmote() [1/2]

void Player::TextEmote ( std::string_view  text,
WorldObject const *  = nullptr,
bool  = false 
)
overridevirtual

Outputs an universal text which is supposed to be an action.

Reimplemented from Unit.

9419{
9420 std::string _text(text);
9421
9422 if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
9423 {
9424 return;
9425 }
9426
9427 sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
9428
9429 WorldPacket data;
9431
9432 SendDirectMessage(&data);
9433
9434 // Special handling for messages, do not use visibility map for stealthed units
9435 Acore::MessageDistDeliverer notifier(this, &data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE), nullptr, true);
9436 Cell::VisitObjects(this, notifier, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
9437}
@ CHAT_MSG_EMOTE
Definition SharedDefines.h:3401
@ LANG_UNIVERSAL
Definition SharedDefines.h:735
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE
Definition WorldConfig.h:117
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition WorldConfig.h:148

References ChatHandler::BuildChatPacket(), CHAT_MSG_EMOTE, CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, LANG_UNIVERSAL, SendDirectMessage(), sScriptMgr, sWorld, and Cell::VisitObjects().

Referenced by WorldSession::HandleMessagechatOpcode().

◆ TextEmote() [2/2]

void Player::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
overridevirtual

Reimplemented from Unit.

9440{
9441 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
9442}

References CHAT_MSG_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToggleAFK()

void Player::ToggleAFK ( )
1305{
1307
1308 // afk player not allowed in battleground
1309 if (!IsGameMaster() && isAFK() && InBattleground())
1311}
void ToggleFlag(uint16 index, uint32 flag)
Definition Object.cpp:866
void LeaveBattleground(Battleground *bg=nullptr)
Definition Player.cpp:11299

References InBattleground(), isAFK(), IsGameMaster(), LeaveBattleground(), PLAYER_FLAGS, PLAYER_FLAGS_AFK, and Object::ToggleFlag().

Referenced by Battleground::AddPlayer(), WorldSession::HandleMessagechatOpcode(), Battlefield::PlayerAcceptInviteToWar(), and Unit::SetCharmedBy().

◆ ToggleDND()

void Player::ToggleDND ( )

◆ ToggleInstantFlight()

void Player::ToggleInstantFlight ( )

References m_isInstantFlightOn.

Referenced by OnGossipSelect().

◆ ToggleMetaGemsActive()

void Player::ToggleMetaGemsActive ( uint8  exceptslot,
bool  apply 
)
11230{
11231 //cycle all equipped items
11232 for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
11233 {
11234 //enchants for the slot being socketed are handled by WorldSession::HandleSocketOpcode(WorldPacket& recvData)
11235 if (slot == exceptslot)
11236 continue;
11237
11238 Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
11239
11240 if (!pItem || !pItem->GetTemplate()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
11241 continue;
11242
11243 //cycle all (gem)enchants
11244 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
11245 {
11246 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11247 if (!enchant_id) //if no enchant go to next enchant(slot)
11248 continue;
11249
11250 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11251 if (!enchantEntry)
11252 continue;
11253
11254 //only metagems to be (de)activated, so only enchants with condition
11255 uint32 condition = enchantEntry->EnchantmentCondition;
11256 if (condition)
11257 ApplyEnchantment(pItem, EnchantmentSlot(enchant_slot), apply);
11258 }
11259 }
11260}

References ApplyEnchantment(), _Socket::Color, SpellItemEnchantmentEntry::EnchantmentCondition, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetEnchantmentId(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, SOCK_ENCHANTMENT_SLOT, ItemTemplate::Socket, and sSpellItemEnchantmentStore.

Referenced by WorldSession::HandleSocketOpcode().

◆ TradeCancel()

void Player::TradeCancel ( bool  sendback,
TradeStatus  status = TRADE_STATUS_TRADE_CANCELED 
)
4089{
4090 if (m_trade)
4091 {
4092 Player* trader = m_trade->GetTrader();
4093
4094 // send yellow "Trade canceled" message to both traders
4095 if (sendback)
4096 GetSession()->SendCancelTrade(status);
4097
4098 trader->GetSession()->SendCancelTrade(status);
4099
4100 // cleanup
4101 delete m_trade;
4102 m_trade = nullptr;
4103 delete trader->m_trade;
4104 trader->m_trade = nullptr;
4105 }
4106}
void SendCancelTrade(TradeStatus status)
Definition TradeHandler.cpp:527

References GetSession(), TradeData::GetTrader(), m_trade, and WorldSession::SendCancelTrade().

Referenced by ActivateTaxiPathTo(), CleanupsBeforeDelete(), WorldSession::HandleBusyTradeOpcode(), WorldSession::HandleCancelTradeOpcode(), WorldSession::HandleIgnoreTradeOpcode(), and WorldSession::HandleSocketClosed().

◆ UninviteFromGroup()

void Player::UninviteFromGroup ( )
  • If the player is invited, remove him. If the group if then only 1 person, disband the group.
2331{
2332 Group* group = GetGroupInvite();
2333 if (!group)
2334 return;
2335
2336 group->RemoveInvite(this);
2337
2338 if (group->IsCreated())
2339 {
2340 if (group->GetMembersCount() <= 1) // group has just 1 member => disband
2341 {
2342 group->Disband(true);
2343 group = nullptr; // gets deleted in disband
2344 }
2345 }
2346 else
2347 {
2348 if (group->GetInviteeCount() <= 1)
2349 {
2350 group->RemoveAllInvites();
2351 delete group;
2352 group = nullptr;
2353 }
2354 }
2355}
bool IsCreated() const
Definition Group.cpp:2285
void RemoveAllInvites()
Definition Group.cpp:360
void Disband(bool hideDestroy=false)
Definition Group.cpp:752
void RemoveInvite(Player *player)
Definition Group.cpp:350
uint32 GetInviteeCount() const
Definition Group.h:246
Group * GetGroupInvite()
Definition Player.h:2483

References Group::Disband(), GetGroupInvite(), Group::GetInviteeCount(), Group::GetMembersCount(), Group::IsCreated(), Group::RemoveAllInvites(), and Group::RemoveInvite().

Referenced by WorldSession::HandleGroupDeclineOpcode(), and WorldSession::LogoutPlayer().

◆ UnsummonPetTemporaryIfAny()

void Player::UnsummonPetTemporaryIfAny ( )

◆ Update()

void Player::Update ( uint32  time)
overridevirtual
Todo:
add weapon, skill check

Reimplemented from WorldObject.

54{
55 if (!IsInWorld())
56 return;
57
58 sScriptMgr->OnPlayerBeforeUpdate(this, p_time);
59
60 // undelivered mail
62 {
65
66 // It will be recalculate at mailbox open (for unReadMails important
67 // non-0 until mailbox open, it also will be recalculated)
68 m_nextMailDelivereTime = time_t(0);
69 }
70
71 // Update cinematic location, if 500ms have passed and we're doing a
72 // cinematic now.
75 {
78 }
79
80 // used to implement delayed far teleports
83 Unit::Update(p_time);
85
86 time_t now = GameTime::GetGameTime().count();
87
88 UpdatePvPFlag(now);
90
91 UpdateContestedPvP(p_time);
92
93 UpdateDuelFlag(now);
94
96
97 UpdateAfkReport(now);
98
99 // Xinef: update charm AI only if we are controlled by creature or
100 // non-posses player charm
102 {
103 m_charmUpdateTimer += p_time;
104 if (m_charmUpdateTimer >= 1000)
105 {
107 if (Unit* charmer = GetCharmer())
108 if (charmer->IsAlive())
110 }
111 }
112
113 time_t lastTick = m_Last_tick;
114 if (now > m_Last_tick)
115 {
116 // Update items that have just a limited lifetime
118
119 // check every minute, less chance to crash and wont break anything.
121
122 // Played time
123 uint32 elapsed = uint32(now - m_Last_tick);
124 m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time
125 m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time
126 GetSession()->SetTotalTime(GetSession()->GetTotalTime() + elapsed);
127 m_Last_tick = now;
128 }
129
130 // If mute expired, remove it from the DB
131 if (GetSession()->m_muteTime && GetSession()->m_muteTime < now)
132 {
133 GetSession()->m_muteTime = 0;
135 LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
136 stmt->SetData(0, 0); // Set the mute time to 0
137 stmt->SetData(1, "");
138 stmt->SetData(2, "");
139 stmt->SetData(3, GetSession()->GetAccountId());
140 LoginDatabase.Execute(stmt);
141 }
142
143 if (!m_timedquests.empty())
144 {
145 QuestSet::iterator iter = m_timedquests.begin();
146 while (iter != m_timedquests.end())
147 {
148 QuestStatusData& q_status = m_QuestStatus[*iter];
149 if (q_status.Timer <= p_time)
150 {
151 uint32 quest_id = *iter;
152 ++iter; // current iter will be removed in FailQuest
153 FailQuest(quest_id);
154 }
155 else
156 {
157 q_status.Timer -= p_time;
158 m_QuestStatusSave[*iter] = true;
159 ++iter;
160 }
161 }
162 }
163
164 m_achievementMgr->Update(p_time);
165
167 {
168 if (Unit* victim = GetVictim())
169 {
170 // default combat reach 10
172
174 {
175 if (!IsWithinMeleeRange(victim))
176 {
178 if (m_swingErrorMsg != 1) // send single time (client auto repeat)
179 {
181 m_swingErrorMsg = 1;
182 }
183 }
184 // 120 degrees of radiant range, if player is not in boundary radius
185 else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * float(M_PI) / 3, victim))
186 {
188 if (m_swingErrorMsg != 2) // send single time (client auto repeat)
189 {
191 m_swingErrorMsg = 2;
192 }
193 }
194 else
195 {
196 m_swingErrorMsg = 0; // reset swing error state
197
198 // prevent base and off attack in same time, delay attack at
199 // 0.2 sec
203
204 // do attack
207 }
208 }
209
211 {
212 if (!IsWithinMeleeRange(victim))
214 else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * float(M_PI) / 3, victim))
216 else
217 {
218 // prevent base and off attack in same time, delay attack at
219 // 0.2 sec
222
223 // do attack
226 }
227 }
228
229 /*Unit* owner = victim->GetOwner();
230 Unit* u = owner ? owner : victim;
231 if (u->IsPvP() && (!duel || duel->opponent != u))
232 {
233 UpdatePvP(true);
234 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
235 }*/
236 }
237 }
238
240 {
241 if (now > lastTick && _restTime > 0) // freeze update
242 {
243 time_t currTime = GameTime::GetGameTime().count();
244 time_t timeDiff = currTime - _restTime;
245 if (timeDiff >= 10) // freeze update
246 {
247 _restTime = currTime;
248
249 float bubble = 0.125f * sWorld->getRate(RATE_REST_INGAME);
250 float extraPerSec =
251 ((float) GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000.0f) *
252 bubble;
253
254 // speed collect rest bonus (section/in hour)
255 SetRestBonus(GetRestBonus() + timeDiff * extraPerSec);
256 }
257 }
258 }
259
260 if (m_weaponChangeTimer > 0)
261 {
262 if (p_time >= m_weaponChangeTimer)
264 else
265 m_weaponChangeTimer -= p_time;
266 }
267
268 if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId
269 {
270 LOG_INFO("misc", "Player::Update - invalid position ({:0.1f}, {:0.1f}, {:0.1f})! Map: {}, MapId: {}, {}",
272 GetSession()->KickPlayer("Invalid position");
273 return;
274 }
275
276 if (m_zoneUpdateTimer > 0)
277 {
278 if (p_time >= m_zoneUpdateTimer)
279 {
280 // On zone update tick check if we are still in an inn if we are
281 // supposed to be in one
283 {
284 AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(GetInnTriggerId());
285 if (!atEntry || !IsInAreaTriggerRadius(atEntry, 5.f))
286 {
288 }
289 }
290
291 uint32 newzone, newarea;
292 GetZoneAndAreaId(newzone, newarea);
293
294 if (m_zoneUpdateId != newzone)
295 UpdateZone(newzone, newarea); // also update area
296 else
297 {
298 // use area updates as well
299 // needed for free far all arenas for example
300 if (m_areaUpdateId != newarea)
301 UpdateArea(newarea);
302 }
303
305 }
306 else
307 m_zoneUpdateTimer -= p_time;
308 }
309
310 sScriptMgr->OnPlayerUpdate(this, p_time);
311
312 if (IsAlive())
313 {
314 m_regenTimer += p_time;
316 }
317
319 KillPlayer();
320
321 if (m_nextSave)
322 {
323 if (p_time >= m_nextSave)
324 {
325 // m_nextSave reset in SaveToDB call
326 SaveToDB(false, false);
327 LOG_DEBUG("entities.player", "Player::Update: Player '{}' ({}) saved", GetName(), GetGUID().ToString());
328 }
329 else
330 {
331 m_nextSave -= p_time;
332 }
333 }
334
335 // Handle Water/drowning
336 HandleDrowning(p_time);
337
338 if (GetDrunkValue())
339 {
340 m_drunkTimer += p_time;
343 }
344
345 if (HasPendingBind())
346 {
347 if (_pendingBindTimer <= p_time)
348 {
349 // Player left the instance
352 SetPendingBind(0, 0);
353 }
354 else
355 _pendingBindTimer -= p_time;
356 }
357
358 // not auto-free ghost from body in instances
359 if (m_deathTimer > 0 && !GetMap()->Instanceable() &&
361 {
362 if (p_time >= m_deathTimer)
363 {
364 m_deathTimer = 0;
367 }
368 else
369 m_deathTimer -= p_time;
370 }
371
372 UpdateEnchantTime(p_time);
373 UpdateHomebindTime(p_time);
374
375 if (!_instanceResetTimes.empty())
376 {
377 for (InstanceTimeMap::iterator itr = _instanceResetTimes.begin();
378 itr != _instanceResetTimes.end();)
379 {
380 if (itr->second < now)
381 _instanceResetTimes.erase(itr++);
382 else
383 ++itr;
384 }
385 }
386
387 // group update
389
390 Pet* pet = GetPet();
391 if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityRange()) &&
392 !pet->isPossessed())
393 // if (pet && !pet->IsWithinDistInMap(this,
394 // GetMap()->GetVisibilityDistance()) && (GetCharmGUID() &&
395 // (pet->GetGUID()
396 // != GetCharmGUID())))
398
399 // pussywizard:
400 if (m_hostileReferenceCheckTimer <= p_time)
401 {
403 if (!GetMap()->IsDungeon())
406 }
407 else
409
410 // we should execute delayed teleports only for alive(!) players
411 // because we don't want player's ghost teleported from graveyard
412 // xinef: so we store it to the end of the world and teleport out of the ass
413 // after resurrection?
414 if (HasDelayedTeleport() /* && IsAlive()*/)
415 {
418 }
419
421 {
423 UpdateObjectVisibility(true, true);
426 }
427}
constexpr auto CINEMATIC_UPDATEDIFF
Definition CinematicMgr.h:26
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition DatabaseEnv.cpp:22
@ LOGIN_UPD_MUTE_TIME
Definition LoginDatabase.h:72
@ NOTIFY_VISIBILITY_CHANGED
Definition Object.h:70
constexpr auto ZONE_UPDATE_INTERVAL
Definition PlayerUpdates.cpp:51
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:131
@ UNIT_STATE_CHARGING
Definition UnitDefines.h:187
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
@ UNIT_FLAG_POSSESSED
Definition UnitDefines.h:274
#define ATTACK_DISPLAY_DELAY
Definition Unit.h:614
@ RATE_REST_INGAME
Definition WorldConfig.h:453
void Update(uint32 timeDiff)
Definition AchievementMgr.cpp:2183
std::vector< FlyByCamera > const * m_cinematicCamera
Definition CinematicMgr.h:56
uint32 m_cinematicDiff
Definition CinematicMgr.h:52
uint32 m_lastCinematicCheck
Definition CinematicMgr.h:53
uint32 m_activeCinematicCameraId
Definition CinematicMgr.h:54
void UpdateCinematicLocation(uint32 diff)
Definition CinematicMgr.cpp:92
void deleteReferencesOutOfRange(float range)
Definition HostileRefMgr.cpp:199
void UpdateEnchantTime(uint32 time)
Definition PlayerStorage.cpp:4162
uint32 GetInnTriggerId() const
Definition Player.h:1222
void UpdateContestedPvP(uint32 currTime)
Definition PlayerMisc.cpp:360
void SendAttackSwingBadFacingAttack()
Definition PlayerMisc.cpp:146
void SendUpdateToOutOfRangeGroupMembers()
Definition Player.cpp:11673
void KillPlayer()
Definition Player.cpp:4584
void UpdateDuelFlag(time_t currTime)
Definition PlayerMisc.cpp:423
bool HasRestFlag(RestFlag restFlag) const
Definition Player.h:1219
bool HasDelayedTeleport() const
Definition Player.h:2968
void SendAttackSwingNotInRange()
Definition PlayerMisc.cpp:78
void UpdateSoulboundTradeItems()
Definition PlayerStorage.cpp:4108
void RemoveRestFlag(RestFlag restFlag)
Definition Player.cpp:16132
void CheckDuelDistance(time_t currTime)
Definition Player.cpp:6402
void UpdatePvPFlag(time_t currTime)
Definition PlayerMisc.cpp:372
void HandleSobering()
The player sobers by 1% every 9 seconds.
Definition Player.cpp:961
void UpdateFFAPvPFlag(time_t currTime)
Definition PlayerMisc.cpp:391
void BindToInstance()
Definition PlayerStorage.cpp:6522
void FailQuest(uint32 quest_id)
Definition PlayerQuest.cpp:886
void ProcessSpellQueue()
Definition PlayerUpdates.cpp:2378
void HandleDrowning(uint32 time_diff)
Definition Player.cpp:844
void UpdateCharmedAI()
Definition PlayerUpdates.cpp:1956
void UpdateHomebindTime(uint32 time)
Definition PlayerUpdates.cpp:1397
bool IsInAreaTriggerRadius(AreaTrigger const *trigger, float delta=0.f) const
Definition Player.cpp:2197
void RegenerateAll()
Definition Player.cpp:1768
void UpdateAfkReport(time_t currTime)
checks the 15 afk reports per 5 minutes limit
Definition PlayerMisc.cpp:351
bool HasOffhandWeaponForAttack() const
Definition Unit.h:929
bool IsCharmed() const
Definition Unit.h:1237
bool IsWithinBoundaryRadius(const Unit *obj) const
Definition Unit.cpp:704
Unit * GetCharmer() const
Definition Unit.cpp:10694
void setAttackTimer(WeaponAttackType type, int32 time)
Definition Unit.h:830
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition Unit.cpp:665
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2026
bool isPossessed() const
Definition Unit.h:1238
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition Unit.cpp:2591
void Update(uint32 time) override
Definition Unit.cpp:383
int32 getAttackTimer(WeaponAttackType type) const
Definition Unit.h:832
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:833
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition Unit.cpp:643
uint16 m_delayed_unit_relocation_timer
Definition Unit.h:2024
void RemoveFromNotify(uint16 f)
Definition Object.h:648
void SetTotalTime(uint32 TotalTime)
Definition WorldSession.h:394
void KickPlayer(bool setKicked=true)
Definition WorldSession.h:419
Definition ObjectMgr.h:420
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition Position.cpp:141

References _cinematicMgr, _instanceResetTimes, _pendingBindId, _pendingBindTimer, _restTime, ATTACK_DISPLAY_DELAY, Unit::AttackerStateUpdate(), BASE_ATTACK, BindToInstance(), Unit::bRequestForcedVisibilityUpdate, BuildPlayerRepop(), CheckDuelDistance(), CINEMATIC_UPDATEDIFF, HostileRefMgr::deleteReferencesOutOfRange(), FailQuest(), WorldObject::FindMap(), Unit::getAttackTimer(), Unit::GetCharmer(), GetDrunkValue(), GameTime::GetGameTime(), Object::GetGUID(), Unit::getHostileRefMgr(), GetInnTriggerId(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), getMSTime(), GetMSTimeDiffToNow(), WorldObject::GetName(), GetPet(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetRestBonus(), GetSession(), Object::GetUInt32Value(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), WorldObject::GetZoneAndAreaId(), HandleDrowning(), HandleSobering(), HasDelayedTeleport(), Position::HasInArc(), Unit::HasOffhandWeaponForAttack(), HasPendingBind(), HasPlayerFlag(), Unit::HasPreventResurectionAura(), HasRestFlag(), Unit::HasUnitFlag(), Unit::HasUnitState(), IN_MILLISECONDS, Unit::IsAlive(), Unit::isAttackReady(), IsBeingTeleported(), Unit::IsCharmed(), IsInAreaTriggerRadius(), Object::IsInWorld(), Position::IsPositionValid(), Unit::isPossessed(), Unit::IsWithinBoundaryRadius(), WorldObject::IsWithinDistInMap(), Unit::IsWithinMeleeRange(), JustDied, WorldSession::KickPlayer(), KillPlayer(), LOG_DEBUG, LOG_INFO, LOGIN_UPD_MUTE_TIME, LoginDatabase, m_achievementMgr, CinematicMgr::m_activeCinematicCameraId, m_areaUpdateId, m_charmUpdateTimer, CinematicMgr::m_cinematicCamera, CinematicMgr::m_cinematicDiff, Unit::m_deathState, m_deathTimer, Unit::m_delayed_unit_relocation_timer, m_drunkTimer, m_hostileReferenceCheckTimer, m_Last_tick, CinematicMgr::m_lastCinematicCheck, WorldSession::m_muteTime, m_nextMailDelivereTime, m_nextSave, m_Played_time, m_QuestStatus, m_QuestStatusSave, Unit::m_regenTimer, m_swingErrorMsg, m_timedquests, m_weaponChangeTimer, m_zoneUpdateId, m_zoneUpdateTimer, NOTIFY_VISIBILITY_CHANGED, OFF_ATTACK, PET_SAVE_NOT_IN_SLOT, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER_FLAGS_RESTING, PLAYER_NEXT_LEVEL_XP, ProcessSpellQueue(), RATE_REST_INGAME, RegenerateAll(), WorldObject::RemoveFromNotify(), RemovePet(), RemoveRestFlag(), RepopAtGraveyard(), Unit::resetAttackTimer(), REST_FLAG_IN_TAVERN, SaveToDB(), SendAttackSwingBadFacingAttack(), SendAttackSwingNotInRange(), SendNewMail(), SendUpdateToOutOfRangeGroupMembers(), Unit::setAttackTimer(), PreparedStatementBase::SetData(), SetHasDelayedTeleport(), SetMustDelayTeleport(), SetPendingBind(), SetRestBonus(), WorldSession::SetTotalTime(), sObjectMgr, sScriptMgr, sWorld, teleportStore_dest, teleportStore_options, TeleportTo(), QuestStatusData::Timer, ObjectGuid::ToString(), Position::ToString(), UNIT_FLAG_POSSESSED, UNIT_STATE_CASTING, UNIT_STATE_CHARGING, UNIT_STATE_MELEE_ATTACKING, unReadMails, Unit::Update(), AchievementMgr::Update(), UpdateAfkReport(), UpdateArea(), UpdateCharmedAI(), CinematicMgr::UpdateCinematicLocation(), UpdateContestedPvP(), UpdateDuelFlag(), UpdateEnchantTime(), UpdateFFAPvPFlag(), UpdateHomebindTime(), UpdateItemDuration(), UpdateObjectVisibility(), UpdatePvPFlag(), UpdateSoulboundTradeItems(), UpdateZone(), and ZONE_UPDATE_INTERVAL.

Referenced by Map::Update().

◆ UpdateAchievementCriteria()

void Player::UpdateAchievementCriteria ( AchievementCriteriaTypes  type,
uint32  miscValue1 = 0,
uint32  miscValue2 = 0,
Unit unit = nullptr 
)
2183{
2184 m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2,
2185 unit);
2186}
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition AchievementMgr.cpp:817

References m_achievementMgr, and AchievementMgr::UpdateAchievementCriteria().

Referenced by _addSpell(), Spell::_cast(), KillRewarder::_RewardKillCredit(), ActivateTaxiPathTo(), CheckAreaExploreAndOutdoor(), Group::CountTheRoll(), Unit::DealDamage(), Spell::DoSpellHitOnUnit(), FlightPathMovementGenerator::DoUpdate(), InstanceScript::DoUpdateAchievementCriteria(), DuelComplete(), EnvironmentalDamage(), EquipItem(), EquipNewItem(), lfg::LFGMgr::FinishDungeon(), GiveLevel(), WorldSession::HandleAlterAppearance(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBuyBankSlotOpcode(), HandleFall(), WorldSession::HandleGameobjectReportUse(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleLootRoll(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandleQuestLogRemoveQuest(), reset_commandscript::HandleResetHonorCommand(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleTextEmoteOpcode(), Unit::Kill(), KilledMonsterCredit(), ArenaTeamMember::ModifyPersonalRating(), MoveItemToInventory(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), InstanceSaveMgr::PlayerBindToInstance(), QuickEquipItem(), resetTalents(), RewardHonor(), RewardQuest(), AuctionHouseMgr::SendAuctionSuccessfulMail(), AuctionHouseMgr::SendAuctionWonMail(), setDeathState(), SetMoney(), ReputationMgr::SetOneFactionReputation(), SetSkill(), SetTitle(), StoreNewItem(), SummonIfPossible(), UpdateLootAchievements(), BattlegroundAB::UpdatePlayerScore(), BattlegroundAV::UpdatePlayerScore(), BattlegroundEY::UpdatePlayerScore(), BattlegroundIC::UpdatePlayerScore(), BattlegroundWS::UpdatePlayerScore(), UpdateSkill(), UpdateSkillPro(), and GameObject::Use().

◆ UpdateAfkReport()

void Player::UpdateAfkReport ( time_t  currTime)

checks the 15 afk reports per 5 minutes limit

352{
353 if (m_bgData.bgAfkReportedTimer <= currTime)
354 {
356 m_bgData.bgAfkReportedTimer = currTime + 5 * MINUTE;
357 }
358}
time_t bgAfkReportedTimer
Definition Player.h:1051

References BGData::bgAfkReportedCount, BGData::bgAfkReportedTimer, m_bgData, and MINUTE.

Referenced by Update().

◆ UpdateAllCritPercentages()

void Player::UpdateAllCritPercentages ( )

◆ UpdateAllRatings()

void Player::UpdateAllRatings ( )
703{
704 for (int cr = 0; cr < MAX_COMBAT_RATING; ++cr)
706}
CombatRating
Definition Unit.h:217

References MAX_COMBAT_RATING, and UpdateRating().

Referenced by UpdateAllStats().

◆ UpdateAllSpellCritChances()

void Player::UpdateAllSpellCritChances ( )
889{
890 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
892}
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:283
void UpdateSpellCritChance(uint32 school)
Definition StatSystem.cpp:839

References MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, and UpdateSpellCritChance().

Referenced by AuraEffect::HandleAuraModCritPct(), AuraEffect::HandleModSpellCritChance(), UpdateAllStats(), UpdateRating(), and UpdateStats().

◆ UpdateAllStats()

bool Player::UpdateAllStats ( )
overridevirtual

Implements Unit.

206{
207 for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
208 {
209 float value = GetTotalStatValue(Stats(i));
210 SetStat(Stats(i), int32(value));
211 }
212
213 UpdateArmor();
214 // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
217
218 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
220
232
233 return true;
234}
void UpdateAllSpellCritChances()
Definition StatSystem.cpp:888
void UpdateArmor() override
Definition StatSystem.cpp:269
void UpdateSpellDamageAndHealingBonus()
Definition StatSystem.cpp:194
void UpdateMaxHealth() override
Definition StatSystem.cpp:313
void UpdateAllRatings()
Definition PlayerUpdates.cpp:702
void UpdateAllCritPercentages()
Definition StatSystem.cpp:697
void UpdateDefenseBonusesMod()
Definition StatSystem.cpp:626
virtual void UpdateAllResistances()
Definition StatSystem.cpp:54
float GetTotalStatValue(Stats stat, float additionalValue=0.0f) const
Definition Unit.cpp:15394

References BASE_ATTACK, CR_ARMOR_PENETRATION, Unit::GetTotalStatValue(), MAX_POWERS, MAX_STATS, OFF_ATTACK, POWER_MANA, RecalculateRating(), Unit::SetStat(), STAT_STRENGTH, UpdateAllCritPercentages(), UpdateAllRatings(), Unit::UpdateAllResistances(), UpdateAllSpellCritChances(), UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDefenseBonusesMod(), UpdateExpertise(), UpdateManaRegen(), UpdateMaxHealth(), UpdateMaxPower(), UpdateShieldBlockValue(), and UpdateSpellDamageAndHealingBonus().

Referenced by _ApplyAllStatBonuses(), _RemoveAllStatBonuses(), Create(), GiveLevel(), and LoadFromDB().

◆ UpdateArea()

void Player::UpdateArea ( uint32  newArea)
1216{
1217 // pussywizard: inform instance, needed for Icecrown Citadel
1218 if (InstanceScript* instance = GetInstanceScript())
1219 instance->OnPlayerAreaUpdate(this, m_areaUpdateId, newArea);
1220
1221 sScriptMgr->OnPlayerUpdateArea(this, m_areaUpdateId, newArea);
1222
1223 // FFA_PVP flags are area and not zone id dependent
1224 // so apply them accordingly
1225 m_areaUpdateId = newArea;
1226
1227 AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea);
1228 pvpInfo.IsInFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA);
1229 UpdateFFAPvPState(false);
1230
1231 UpdateAreaDependentAuras(newArea);
1232
1233 pvpInfo.IsInNoPvPArea = false;
1234 if (area && area->IsSanctuary())
1235 {
1237 pvpInfo.IsInNoPvPArea = true;
1239 }
1240 else
1242
1243 uint32 const areaRestFlag = (GetTeamId(true) == TEAM_ALLIANCE)
1246 if (area && area->flags & areaRestFlag)
1248 else
1250}
@ AREA_FLAG_ARENA
Definition DBCEnums.h:241
@ AREA_FLAG_REST_ZONE_HORDE
Definition DBCEnums.h:256
@ AREA_FLAG_REST_ZONE_ALLIANCE
Definition DBCEnums.h:257
@ REST_FLAG_IN_FACTION_AREA
Definition Player.h:823
void UpdateFFAPvPState(bool reset=true)
Definition PlayerUpdates.cpp:1457
bool IsSanctuary() const
Definition DBCStructure.h:533
bool IsInNoPvPArea
‍Marks if player is in an area which forces PvP flag
Definition Player.h:368
bool IsInFFAPvPArea
‍Marks if player is in a sanctuary or friendly capital city
Definition Player.h:369

References AREA_FLAG_ARENA, AREA_FLAG_REST_ZONE_ALLIANCE, AREA_FLAG_REST_ZONE_HORDE, Unit::CombatStopWithPets(), AreaTableEntry::flags, WorldObject::GetInstanceScript(), GetTeamId(), PvPInfo::IsInFFAPvPArea, PvPInfo::IsInNoPvPArea, AreaTableEntry::IsSanctuary(), m_areaUpdateId, pvpInfo, Object::RemoveByteFlag(), RemoveRestFlag(), REST_FLAG_IN_FACTION_AREA, sAreaTableStore, Object::SetByteFlag(), SetRestFlag(), sScriptMgr, TEAM_ALLIANCE, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_FIELD_BYTES_2, UpdateAreaDependentAuras(), and UpdateFFAPvPState().

Referenced by SetGameMaster(), Update(), and UpdateZone().

◆ UpdateAreaDependentAuras()

void Player::UpdateAreaDependentAuras ( uint32  area_id)
1870{
1871 // remove auras from spells with area limitations
1872 for (AuraMap::iterator iter = m_ownedAuras.begin();
1873 iter != m_ownedAuras.end();)
1874 {
1875 // use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or
1876 // instead UpdateZone in both cases m_zoneUpdateId up-to-date
1877 if (iter->second->GetSpellInfo()->CheckLocation(
1878 GetMapId(), m_zoneUpdateId, newArea, this, false) !=
1880 RemoveOwnedAura(iter);
1881 else
1882 ++iter;
1883 }
1884
1885 // Xinef: check controlled auras
1886 if (!m_Controlled.empty())
1887 for (ControlSet::iterator itr = m_Controlled.begin();
1888 itr != m_Controlled.end();)
1889 {
1890 Unit* controlled = *itr;
1891 ++itr;
1892 if (controlled && !controlled->IsPet())
1893 {
1894 Unit::AuraMap& tAuras = controlled->GetOwnedAuras();
1895 for (Unit::AuraMap::iterator auraIter = tAuras.begin();
1896 auraIter != tAuras.end();)
1897 {
1898 if (auraIter->second->GetSpellInfo()->CheckLocation(
1899 GetMapId(), m_zoneUpdateId, newArea, nullptr) !=
1901 controlled->RemoveOwnedAura(auraIter);
1902 else
1903 ++auraIter;
1904 }
1905 }
1906 }
1907
1908 // some auras applied at subzone enter
1909 SpellAreaForAreaMapBounds saBounds =
1910 sSpellMgr->GetSpellAreaForAreaMapBounds(newArea);
1911 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first;
1912 itr != saBounds.second; ++itr)
1913 if (itr->second->autocast &&
1914 itr->second->IsFitToRequirements(this, m_zoneUpdateId, newArea))
1915 if (!HasAura(itr->second->spellId))
1916 CastSpell(this, itr->second->spellId, true);
1917
1918 if (newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar
1919 {
1920 switch (GetVehicleBase()->GetEntry())
1921 {
1922 case 33062:
1923 case 33109:
1924 case 33060:
1925 GetVehicle()->Dismiss();
1926 break;
1927 }
1928 }
1929}
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition SpellMgr.h:550
Unit * GetVehicleBase() const
Definition Unit.cpp:18830
std::multimap< uint32, Aura * > AuraMap
Definition Unit.h:625
AuraMap & GetOwnedAuras()
Definition Unit.h:1296
void Dismiss()
Definition Vehicle.cpp:539

References Unit::CastSpell(), Vehicle::Dismiss(), Object::GetEntry(), WorldLocation::GetMapId(), Unit::GetOwnedAuras(), Position::GetPositionX(), Unit::GetVehicle(), Unit::GetVehicleBase(), Unit::HasAura(), Unit::IsPet(), Unit::m_Controlled, Unit::m_ownedAuras, m_zoneUpdateId, Unit::RemoveOwnedAura(), SPELL_CAST_OK, and sSpellMgr.

Referenced by AddQuest(), CompleteQuest(), WorldSession::HandlePlayerLoginFromDB(), IncompleteQuest(), RemoveActiveQuest(), RewardQuest(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), and UpdateArea().

◆ UpdateArmor()

void Player::UpdateArmor ( )
overridevirtual

Implements Unit.

270{
271 UnitMods unitMod = UNIT_MOD_ARMOR;
272
273 float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items)
274 value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items
275 value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats
276 value += GetModifierValue(unitMod, TOTAL_VALUE);
277
278 //add dynamic flat mods
280 for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
281 {
282 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
283 value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
284 }
285
286 value *= GetModifierValue(unitMod, TOTAL_PCT);
287
288 SetArmor(int32(value));
289
290 UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
291}
@ SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
Definition SpellAuraDefines.h:245

References BASE_PCT, BASE_VALUE, CalculatePct(), Unit::GetAuraEffectsByType(), Unit::GetModifierValue(), Unit::GetStat(), Unit::SetArmor(), SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT, SPELL_SCHOOL_MASK_NORMAL, STAT_AGILITY, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_ARMOR, and UpdateAttackPowerAndDamage().

Referenced by UpdateAllStats(), UpdateResistances(), and UpdateStats().

◆ UpdateArmorPenetration()

void Player::UpdateArmorPenetration ( int32  amount)
865{
866 // Store Rating Value
868}

References CR_ARMOR_PENETRATION, PLAYER_FIELD_COMBAT_RATING_1, and Unit::SetUInt32Value().

Referenced by UpdateRating().

◆ UpdateAttackPowerAndDamage()

void Player::UpdateAttackPowerAndDamage ( bool  ranged = false)
overridevirtual

Implements Unit.

348{
349 float val2 = 0.0f;
350 float level = float(GetLevel());
351
352 sScriptMgr->OnPlayerBeforeUpdateAttackPowerAndDamage(this, level, val2, ranged);
353
355
359
360 if (ranged)
361 {
365
367 {
368 val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f;
369 }
371 {
372 val2 = level + GetStat(STAT_AGILITY) - 10.0f;
373 }
375 {
376 switch (GetShapeshiftForm())
377 {
378 case FORM_CAT:
379 case FORM_BEAR:
380 case FORM_DIREBEAR:
381 val2 = 0.0f;
382 break;
383 default:
384 val2 = GetStat(STAT_AGILITY) - 10.0f;
385 break;
386 }
387 }
388 else
389 {
390 val2 = GetStat(STAT_AGILITY) - 10.0f;
391 }
392 }
393 else
394 {
396 {
397 val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
398 }
400 {
401 val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
402 }
404 {
405 // Check if Predatory Strikes is skilled
406 float mLevelMult = 0.0f;
407 float weapon_bonus = 0.0f;
408 if (IsInFeralForm())
409 {
411 for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
412 {
413 AuraEffect* aurEff = *itr;
414 if (aurEff->GetSpellInfo()->SpellIconID == 1563)
415 {
416 switch (aurEff->GetEffIndex())
417 {
418 case 0: // Predatory Strikes (effect 0)
419 mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
420 break;
421 case 1: // Predatory Strikes (effect 1)
422 if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
423 {
424 // also gains % attack power from equipped weapon
425 ItemTemplate const* proto = mainHand->GetTemplate();
426 if (!proto)
427 continue;
428
429 uint32 ap = proto->getFeralBonus();
430 // Get AP Bonuses from weapon
431 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
432 {
433 if (i >= proto->StatsCount)
434 break;
435
437 ap += proto->ItemStat[i].ItemStatValue;
438 }
439
440 // Get AP Bonuses from weapon spells
441 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
442 {
443 // no spell
444 if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
445 continue;
446
447 // check if it is valid spell
448 SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId);
449 if (!spellproto)
450 continue;
451
452 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
453 if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER)
454 ap += spellproto->Effects[j].CalcValue();
455 }
456
457 weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount());
458 }
459 break;
460 default:
461 break;
462 }
463 }
464 }
465 }
466
467 switch (GetShapeshiftForm())
468 {
469 case FORM_CAT:
470 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f + weapon_bonus + m_baseFeralAP;
471 break;
472 case FORM_BEAR:
473 case FORM_DIREBEAR:
474 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + weapon_bonus + m_baseFeralAP;
475 break;
476 case FORM_MOONKIN:
477 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP;
478 break;
479 default:
480 val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
481 break;
482 }
483 }
485 {
486 val2 = GetStat(STAT_STRENGTH) - 10.0f;
487 }
488 }
489
490 SetModifierValue(unitMod, BASE_VALUE, val2);
491
492 float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
493 float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
494
495 //add dynamic flat mods
496 if (ranged)
497 {
498 if ((getClassMask() & CLASSMASK_WAND_USERS) == 0)
499 {
501 for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
502 attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
503 }
504 }
505 else
506 {
508 for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
509 attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
510
512 for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
513 // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
514 attPowerMod += int32(GetArmor() / (*iter)->GetAmount());
515 }
516
517 float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
518
519 sScriptMgr->OnPlayerAfterUpdateAttackPowerAndDamage(this, level, base_attPower, attPowerMod, attPowerMultiplier, ranged);
520 SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
521 SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
522 SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
523
524 //automatically update weapon damage after attack power modification
525 if (ranged)
526 {
528 }
529 else
530 {
532 if (CanDualWield() && HasOffhandWeaponForAttack()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
536 }
537}
@ SPELL_AURA_MOD_ATTACK_POWER
Definition SpellAuraDefines.h:162
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
Definition SpellAuraDefines.h:275
@ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
Definition SpellAuraDefines.h:348
@ SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
Definition SpellAuraDefines.h:331
@ FORM_MOONKIN
Definition UnitDefines.h:98
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition Unit.h:1015
_ItemStat ItemStat[MAX_ITEM_PROTO_STATS]
Definition ItemTemplate.h:648
int32 getFeralBonus(int32 extraDPS=0) const
Definition ItemTemplate.h:743
uint32 StatsCount
Definition ItemTemplate.h:647
int32 ItemStatValue
Definition ItemTemplate.h:587
uint32 ItemStatType
Definition ItemTemplate.h:586

References BASE_ATTACK, BASE_PCT, BASE_VALUE, CalculatePct(), Unit::CanDualWield(), CLASS_CONTEXT_STATS, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CLASSMASK_WAND_USERS, SpellInfo::Effects, EQUIPMENT_SLOT_MAINHAND, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_MOONKIN, AuraEffect::GetAmount(), Unit::GetArmor(), Unit::GetAuraEffectsByType(), Unit::getClassMask(), AuraEffect::GetEffIndex(), ItemTemplate::getFeralBonus(), Unit::GetLevel(), Unit::GetModifierValue(), Unit::GetShapeshiftForm(), AuraEffect::GetSpellInfo(), Unit::GetStat(), Unit::HasOffhandWeaponForAttack(), IsClass(), Unit::IsInFeralForm(), ITEM_MOD_ATTACK_POWER, ITEM_SPELLTRIGGER_ON_EQUIP, ItemTemplate::ItemStat, _ItemStat::ItemStatType, _ItemStat::ItemStatValue, m_baseFeralAP, m_items, MAX_ITEM_PROTO_SPELLS, MAX_ITEM_PROTO_STATS, MAX_SPELL_EFFECTS, OFF_ATTACK, RANGED_ATTACK, Object::SetFloatValue(), Object::SetInt32Value(), Unit::SetModifierValue(), SPELL_AURA_DUMMY, SPELL_AURA_MOD_ATTACK_POWER, SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR, SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, SpellInfo::SpellIconID, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, sSpellMgr, STAT_AGILITY, STAT_STRENGTH, ItemTemplate::StatsCount, TOTAL_PCT, TOTAL_VALUE, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, Unit::UpdateDamagePhysical(), and UpdateSpellDamageAndHealingBonus().

Referenced by ApplyFeralAPBonus(), AuraEffect::HandleAuraModAttackPowerOfArmor(), AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(), InitDataForForm(), UpdateAllStats(), UpdateArmor(), and UpdateStats().

◆ UpdateBlockPercentage()

void Player::UpdateBlockPercentage ( )
634{
635 // No block
636 float value = 0.0f;
637 if (CanBlock())
638 {
639 // Base value
640 value = 5.0f;
641 // Modify value from defense skill
642 value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
643 // Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
645 // Increase from rating
647
648 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
649 {
650 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Block", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Block", 95.0f) : value;
651 }
652
653 value = value < 0.0f ? 0.0f : value;
654 }
656}
#define sConfigMgr
Definition Config.h:74
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition SpellAuraDefines.h:114
void SetStatFloatValue(uint16 index, float value)
Definition Object.cpp:779
bool CanBlock() const
Definition Player.h:2203
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition Unit.cpp:3653

References CanBlock(), CR_BLOCK, Unit::GetDefenseSkillValue(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), Unit::GetTotalAuraModifier(), PLAYER_BLOCK_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), and SPELL_AURA_MOD_BLOCK_PERCENT.

Referenced by AuraEffect::HandleAuraModBlockPercent(), SetCanBlock(), UpdateDefenseBonusesMod(), and UpdateRating().

◆ UpdateCharmedAI()

void Player::UpdateCharmedAI ( )
private
1957{
1958 // Xinef: maybe passed as argument?
1959 Unit* charmer = GetCharmer();
1960 CharmInfo* charmInfo = GetCharmInfo();
1961
1962 // Xinef: needs more thinking, maybe kill player?
1963 if (!charmer || !charmInfo)
1964 return;
1965
1966 // Xinef: we should be killed if caster enters evade mode and charm is
1967 // infinite
1968 if (charmer->IsCreature() &&
1969 charmer->ToCreature()->IsInEvadeMode())
1970 {
1971 AuraEffectList const& auras =
1973 for (AuraEffectList::const_iterator iter = auras.begin();
1974 iter != auras.end(); ++iter)
1975 if ((*iter)->GetCasterGUID() == charmer->GetGUID() &&
1976 (*iter)->GetBase()->IsPermanent())
1977 {
1978 Unit::DealDamage(charmer, this, GetHealth(), nullptr,
1980 nullptr, false);
1981 return;
1982 }
1983 }
1984
1985 Unit* target = GetVictim();
1986 if (target)
1987 {
1988 SetInFront(target);
1990 }
1991
1993 return;
1994
1995 bool Mages =
1996 getClassMask() & (1 << (CLASS_MAGE - 1) | 1 << (CLASS_WARLOCK - 1) |
1997 1 << (CLASS_DRUID - 1) | 1 << (CLASS_HUNTER - 1) |
1998 1 << (CLASS_PRIEST - 1));
1999
2000 // Xinef: charmer type specific actions
2001 if (charmer->IsPlayer())
2002 {
2003 bool follow = false;
2004 if (!target)
2005 {
2006 if (charmInfo->GetPlayerReactState() == REACT_PASSIVE)
2007 follow = true;
2008 else if (charmInfo->GetPlayerReactState() == REACT_DEFENSIVE)
2009 {
2010 if (charmer->GetVictim())
2011 target = charmer->GetVictim();
2012 else
2013 follow = true;
2014 }
2015
2016 if (follow)
2017 {
2021 return;
2022 }
2023 }
2024 else if (target &&
2027 GetMotionMaster()->MoveChase(target, Mages ? 15 : 4);
2028 }
2029
2030 if (!target || !IsValidAttackTarget(target))
2031 {
2032 target = SelectNearbyTarget(nullptr, GetMap()->IsDungeon() ? 100.f : 30.f);
2033 if (!target)
2034 {
2038
2039 return;
2040 }
2041
2042 GetMotionMaster()->MoveChase(target, Mages ? 15 : 4);
2043 Attack(target, true);
2044 }
2045 else
2046 {
2047 float Distance = GetDistance(target);
2048 uint8 rnd = urand(0, 1);
2049
2050 if (Mages)
2051 {
2052 if ((GetPower(POWER_MANA) * 100 / GetMaxPower(POWER_MANA)) < 10)
2053 {
2054 GetMotionMaster()->MoveChase(target, 4);
2055 return;
2056 }
2057
2058 if (Distance <= 3)
2059 {
2060 if (urand(0, 1))
2061 {
2064 CastSpell(target, m_charmAISpells[SPELL_T_STUN], false);
2069 false);
2070 else if (m_charmAISpells[SPELL_IMMUNITY] &&
2073 }
2074 else
2075 {
2076 switch (urand(0, 1))
2077 {
2078 case 0:
2082 CastSpell(
2083 target,
2085 false);
2086 break;
2087 case 1:
2092 false);
2093 break;
2094 }
2095 }
2096 }
2097 else
2098 {
2099 switch (urand(0, 2))
2100 {
2101 case 0:
2105 CastSpell(target,
2107 false);
2108 break;
2109 case 1:
2113 CastSpell(target,
2115 false);
2116 break;
2117 case 2:
2121 false);
2122 break;
2123 }
2124 }
2125 }
2126 else
2127 {
2128 if (Distance > 10)
2129 {
2130 GetMotionMaster()->MoveChase(target, 2.0f);
2133 CastSpell(target, m_charmAISpells[SPELL_T_CHARGE], false);
2134 else if (m_charmAISpells[SPELL_FAST_RUN] &&
2137 }
2138
2140 return;
2141
2142 switch (urand(0, 2))
2143 {
2144 case 0:
2148 CastSpell(target,
2150 false);
2151 break;
2152 case 1:
2157 false);
2158 break;
2159 case 2:
2163 break;
2164 }
2165 }
2166 }
2167}
@ CHASE_MOTION_TYPE
Definition MotionMaster.h:45
#define PET_FOLLOW_ANGLE
Definition PetDefines.h:206
#define PET_FOLLOW_DIST
Definition PetDefines.h:205
@ SPELL_HIGH_DAMAGE1
Definition Player.h:926
@ UNIT_STATE_FOLLOW
Definition UnitDefines.h:179
@ REACT_DEFENSIVE
Definition Unit.h:550
@ REACT_PASSIVE
Definition Unit.h:549
bool IsInEvadeMode() const
Definition Creature.h:135
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:313
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:913
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:409
Unit * SelectNearbyTarget(Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
Definition Unit.cpp:17058
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:10333
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:16778
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition Unit.cpp:13963
void SetInFront(WorldObject const *target)
Definition Unit.cpp:20362
ReactStates GetPlayerReactState() const
Definition CharmInfo.h:184

References Unit::Attack(), Unit::CastSpell(), CHASE_MOTION_TYPE, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PRIEST, CLASS_WARLOCK, Unit::DealDamage(), DIRECT_DAMAGE, Unit::GetAuraEffectsByType(), Unit::GetCharmer(), Unit::GetCharmInfo(), Unit::getClassMask(), MotionMaster::GetCurrentMovementGeneratorType(), WorldObject::GetDistance(), Object::GetGUID(), Unit::GetHealth(), WorldObject::GetMap(), Unit::GetMaxPower(), Unit::GetMotionMaster(), CharmInfo::GetPlayerReactState(), Unit::GetPower(), Unit::GetVictim(), HasSpellCooldown(), Unit::HasUnitState(), Object::IsCreature(), Creature::IsInEvadeMode(), Object::IsPlayer(), Unit::IsValidAttackTarget(), m_charmAISpells, MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_ANGLE, PET_FOLLOW_DIST, POWER_MANA, REACT_DEFENSIVE, REACT_PASSIVE, Unit::SelectNearbyTarget(), Unit::SendMovementFlagUpdate(), Unit::SetInFront(), SPELL_AURA_MOD_CHARM, SPELL_DOT_DAMAGE, SPELL_FAST_RUN, SPELL_HIGH_DAMAGE1, SPELL_IMMUNITY, SPELL_INSTANT_DAMAGE, SPELL_ROOT_OR_FEAR, SPELL_SCHOOL_MASK_NORMAL, SPELL_T_CHARGE, SPELL_T_STUN, Object::ToCreature(), UNIT_STATE_CASTING, UNIT_STATE_FOLLOW, and urand().

Referenced by Update().

◆ UpdateCombatSkills()

void Player::UpdateCombatSkills ( Unit victim,
WeaponAttackType  attType,
bool  defence,
Item item = nullptr 
)
1026{
1027 uint8 playerLevel = GetLevel();
1028 uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType);
1029 uint16 currentSkillMax = 5 * playerLevel;
1030 int32 skillDiff = currentSkillMax - currentSkillValue;
1031
1032 // Max skill reached for level.
1033 // Can in some cases be less than 0: having max skill and then .level -1 as example.
1034 if (skillDiff <= 0)
1035 {
1036 return;
1037 }
1038
1039 uint8 greylevel = Acore::XP::GetGrayLevel(playerLevel);
1040 uint8 moblevel = defence ? victim->getLevelForTarget(this) : victim->GetLevel(); // if defense than victim == attacker
1041 /*if (moblevel < greylevel)
1042 return;*/
1043 // Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage.
1044
1045 if (moblevel > playerLevel + 5)
1046 {
1047 moblevel = playerLevel + 5;
1048 }
1049
1050 int16 lvldif = moblevel - greylevel;
1051 if (lvldif < 3)
1052 {
1053 lvldif = 3;
1054 }
1055
1056 float chance = float(3 * lvldif * skillDiff) / playerLevel;
1057 if (!defence)
1058 {
1059 chance += chance * 0.02f * GetStat(STAT_INTELLECT);
1060 }
1061
1062 chance = chance < 1.0f ? 1.0f : chance; // minimum chance to increase skill is 1%
1063
1064 LOG_DEBUG("entities.player", "Player::UpdateCombatSkills(defence:{}, playerLevel:{}, moblevel:{}) -> ({}/{}) chance to increase skill is {}%", defence, playerLevel, moblevel, currentSkillValue, currentSkillMax, chance);
1065
1066 if (roll_chance_f(chance))
1067 {
1068 if (defence)
1069 {
1070 UpdateDefense();
1071 }
1072 else
1073 {
1074 UpdateWeaponSkill(victim, attType, item);
1075 }
1076 }
1077}
uint32 GetBaseDefenseSkillValue() const
Definition Player.h:1948
uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const
Definition Player.cpp:12778
void UpdateDefense()
Definition PlayerUpdates.cpp:603
void UpdateWeaponSkill(Unit *victim, WeaponAttackType attType, Item *item=nullptr)
Definition PlayerUpdates.cpp:981
uint8 getLevelForTarget(WorldObject const *) const override
Definition Unit.h:1027

References GetBaseDefenseSkillValue(), GetBaseWeaponSkillValue(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), Unit::getLevelForTarget(), Unit::GetStat(), LOG_DEBUG, roll_chance_f(), STAT_INTELLECT, UpdateDefense(), and UpdateWeaponSkill().

Referenced by Unit::ProcDamageAndSpellFor().

◆ UpdateContestedPvP()

void Player::UpdateContestedPvP ( uint32  currTime)
361{
363 return;
364 if (m_contestedPvPTimer <= diff)
365 {
367 }
368 else
369 m_contestedPvPTimer -= diff;
370}

References Unit::IsInCombat(), m_contestedPvPTimer, and ResetContestedPvP().

Referenced by Update().

◆ UpdateCorpseReclaimDelay()

void Player::UpdateCorpseReclaimDelay ( )
1932{
1934
1935 if ((pvp &&
1937 (!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
1938 return;
1939
1940 time_t now = GameTime::GetGameTime().count();
1941
1942 if (now < m_deathExpireTime)
1943 {
1944 // full and partly periods 1..3
1945 uint64 count = (m_deathExpireTime - now) / DEATH_EXPIRE_STEP + 1;
1946
1947 if (count < MAX_DEATH_COUNT)
1948 m_deathExpireTime = now + (count + 1) * DEATH_EXPIRE_STEP;
1949 else
1951 }
1952 else
1954}

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, DEATH_EXPIRE_STEP, GameTime::GetGameTime(), m_deathExpireTime, m_ExtraFlags, MAX_DEATH_COUNT, PLAYER_EXTRA_PVP_DEATH, and sWorld.

Referenced by KillPlayer().

◆ UpdateCraftSkill()

bool Player::UpdateCraftSkill ( uint32  spellid)
825{
826 LOG_DEBUG("entities.player.skills", "UpdateCraftSkill spellid {}", spellid);
827
828 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellid);
829
830 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first;
831 _spell_idx != bounds.second; ++_spell_idx)
832 {
833 if (_spell_idx->second->SkillLine)
834 {
835 uint32 SkillValue =
836 GetPureSkillValue(_spell_idx->second->SkillLine);
837
838 // Alchemy Discoveries here
839 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
840 if (spellInfo && spellInfo->Mechanic == MECHANIC_DISCOVERY)
841 {
842 if (uint32 discoveredSpell = GetSkillDiscoverySpell(
843 _spell_idx->second->SkillLine, spellid, this))
844 learnSpell(discoveredSpell);
845 }
846
847 uint32 craft_skill_gain =
848 sWorld->getIntConfig(CONFIG_SKILL_GAIN_CRAFTING);
849 sScriptMgr->OnPlayerUpdateCraftingSkill(this, _spell_idx->second, SkillValue, craft_skill_gain);
850
851 return UpdateSkillPro(
852 _spell_idx->second->SkillLine,
853 SkillGainChance(SkillValue,
854 _spell_idx->second->TrivialSkillLineRankHigh,
855 (_spell_idx->second->TrivialSkillLineRankHigh +
856 _spell_idx->second->TrivialSkillLineRankLow) /
857 2,
858 _spell_idx->second->TrivialSkillLineRankLow),
859 craft_skill_gain);
860 }
861 }
862 return false;
863}
int SkillGainChance(uint32 SkillValue, uint32 GrayLevel, uint32 GreenLevel, uint32 YellowLevel)
Definition PlayerUpdates.cpp:750
@ MECHANIC_DISCOVERY
Definition SharedDefines.h:1353
uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player *player)
Definition SkillDiscovery.cpp:213
@ CONFIG_SKILL_GAIN_CRAFTING
Definition WorldConfig.h:220
bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
Definition PlayerUpdates.cpp:913
uint32 Mechanic
Definition SpellInfo.h:323

References CONFIG_SKILL_GAIN_CRAFTING, GetPureSkillValue(), GetSkillDiscoverySpell(), learnSpell(), LOG_DEBUG, SpellInfo::Mechanic, MECHANIC_DISCOVERY, SkillGainChance(), sScriptMgr, sSpellMgr, sWorld, and UpdateSkillPro().

Referenced by Spell::DoCreateItem(), Spell::EffectEnchantItemPerm(), and spell_gen_profession_research::HandleScript().

◆ UpdateCritPercentage()

void Player::UpdateCritPercentage ( WeaponAttackType  attType)
659{
660 BaseModGroup modGroup;
661 uint16 index;
662 CombatRating cr;
663
664 switch (attType)
665 {
666 case OFF_ATTACK:
667 modGroup = OFFHAND_CRIT_PERCENTAGE;
669 cr = CR_CRIT_MELEE;
670 break;
671 case RANGED_ATTACK:
672 modGroup = RANGED_CRIT_PERCENTAGE;
674 cr = CR_CRIT_RANGED;
675 break;
676 case BASE_ATTACK:
677 default:
678 modGroup = CRIT_PERCENTAGE;
680 cr = CR_CRIT_MELEE;
681 break;
682 }
683
684 float value = GetTotalPercentageModValue(modGroup) + GetRatingBonusValue(cr);
685 // Modify crit from weapon skill and maximized defense skill of same level victim difference
686 value += (int32(GetWeaponSkillValue(attType)) - int32(GetMaxSkillValueForLevel())) * 0.04f;
687
688 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
689 {
690 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Crit", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Crit", 95.0f) : value;
691 }
692
693 value = value < 0.0f ? 0.0f : value;
694 SetStatFloatValue(index, value);
695}
float GetTotalPercentageModValue(BaseModGroup modGroup) const
Definition Player.h:2214
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition Unit.cpp:3818

References BASE_ATTACK, CR_CRIT_MELEE, CR_CRIT_RANGED, CRIT_PERCENTAGE, GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetTotalPercentageModValue(), Unit::GetWeaponSkillValue(), OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, sConfigMgr, and Object::SetStatFloatValue().

Referenced by HandleBaseModValue(), UpdateAllCritPercentages(), and UpdateRating().

◆ UpdateDefense()

void Player::UpdateDefense ( )
604{
606 sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE)))
607 UpdateDefenseBonusesMod(); // update dependent from defense skill part
608}
@ CONFIG_SKILL_GAIN_DEFENSE
Definition WorldConfig.h:221
bool UpdateSkill(uint32 skill_id, uint32 step)
Definition PlayerUpdates.cpp:709

References CONFIG_SKILL_GAIN_DEFENSE, SKILL_DEFENSE, sWorld, UpdateDefenseBonusesMod(), and UpdateSkill().

Referenced by UpdateCombatSkills().

◆ UpdateDefenseBonusesMod()

void Player::UpdateDefenseBonusesMod ( )

◆ UpdateDodgePercentage()

void Player::UpdateDodgePercentage ( )
799{
800 const float dodge_cap[MAX_CLASSES] =
801 {
802 88.129021f, // Warrior
803 88.129021f, // Paladin
804 145.560408f, // Hunter
805 145.560408f, // Rogue
806 150.375940f, // Priest
807 88.129021f, // DK
808 145.560408f, // Shaman
809 150.375940f, // Mage
810 150.375940f, // Warlock
811 0.0f, // ??
812 116.890707f // Druid
813 };
814
815 float diminishing = 0.0f, nondiminishing = 0.0f;
816 GetDodgeFromAgility(diminishing, nondiminishing);
817 // Modify value from defense skill (only bonus from defense rating diminishes)
818 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
819 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
820 // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
822 // Dodge from rating
823 diminishing += GetRatingBonusValue(CR_DODGE);
824 // apply diminishing formula to diminishing dodge chance
825 uint32 pclass = getClass() - 1;
826 m_realDodge = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass]));
827
828 m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge;
829 float value = std::max(diminishing + nondiminishing, 0.0f);
830
831 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
832 {
833 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Dodge", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Dodge", 95.0f) : value;
834 }
835
837}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition SpellAuraDefines.h:112
void GetDodgeFromAgility(float &diminishing, float &nondiminishing)
Definition Player.cpp:5145

References CR_DEFENSE_SKILL, CR_DODGE, Unit::getClass(), GetDodgeFromAgility(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), Unit::GetTotalAuraModifier(), m_diminishing_k, m_realDodge, MAX_CLASSES, PLAYER_DODGE_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), SKILL_DEFENSE, and SPELL_AURA_MOD_DODGE_PERCENT.

Referenced by AuraEffect::HandleAuraModDodgePercent(), UpdateDefenseBonusesMod(), UpdateRating(), and UpdateStats().

◆ UpdateDuelFlag()

void Player::UpdateDuelFlag ( time_t  currTime)
424{
425 if (duel && duel->State == DUEL_STATE_COUNTDOWN && duel->StartTime <= currTime)
426 {
427 sScriptMgr->OnPlayerDuelStart(this, duel->Opponent);
428
430 duel->Opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 2);
431
433 duel->Opponent->duel->State = DUEL_STATE_IN_PROGRESS;
434 }
435}
@ DUEL_STATE_COUNTDOWN
Definition Player.h:377
@ DUEL_STATE_IN_PROGRESS
Definition Player.h:378

References duel, DUEL_STATE_COUNTDOWN, DUEL_STATE_IN_PROGRESS, PLAYER_DUEL_TEAM, Unit::SetUInt32Value(), and sScriptMgr.

Referenced by Update().

◆ UpdateEnchantmentDurations()

void Player::UpdateEnchantmentDurations ( )
4742{
4743 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4744 {
4745 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
4746 }
4747}

References m_enchantDuration.

Referenced by Spell::EffectSummonChangeItem().

◆ UpdateEnchantTime()

void Player::UpdateEnchantTime ( uint32  time)
4163{
4164 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next)
4165 {
4166 ASSERT(itr->item);
4167 next = itr;
4168 if (!itr->item->GetEnchantmentId(itr->slot))
4169 {
4170 next = m_enchantDuration.erase(itr);
4171 }
4172 else if (itr->leftduration <= time)
4173 {
4174 ApplyEnchantment(itr->item, itr->slot, false, false);
4175 itr->item->ClearEnchantment(itr->slot);
4176 next = m_enchantDuration.erase(itr);
4177 }
4178 else if (itr->leftduration > time)
4179 {
4180 itr->leftduration -= time;
4181 ++next;
4182 }
4183 }
4184}

References ApplyEnchantment(), ASSERT, and m_enchantDuration.

Referenced by Update().

◆ UpdateEnergyRegen()

◆ UpdateEquipSpellsAtFormChange()

void Player::UpdateEquipSpellsAtFormChange ( )
1360{
1361 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
1362 {
1363 if (m_items[i] && !m_items[i]->IsBroken() &&
1365 {
1366 ApplyItemEquipSpell(m_items[i], false,
1367 true); // remove spells that not fit to form
1369 m_items[i], true,
1370 true); // add spells that fit form but not active
1371 }
1372 }
1373
1374 // item set bonuses not dependent from item broken state
1375 for (std::size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
1376 {
1377 ItemSetEffect* eff = ItemSetEff[setindex];
1378 if (!eff)
1379 continue;
1380
1381 for (uint32 y = 0; y < MAX_ITEM_SET_SPELLS; ++y)
1382 {
1383 SpellInfo const* spellInfo = eff->spells[y];
1384 if (!spellInfo)
1385 continue;
1386
1387 ApplyEquipSpell(spellInfo, nullptr, false,
1388 true); // remove spells that not fit to form
1389 if (!sScriptMgr->OnPlayerCanApplyEquipSpellsItemSet(this, eff))
1390 break;
1391 ApplyEquipSpell(spellInfo, nullptr, true,
1392 true); // add spells that fit form but not active
1393 }
1394 }
1395}
#define MAX_ITEM_SET_SPELLS
Definition DBCStructure.h:1230
Definition Item.h:32
SpellInfo const * spells[8]
Definition Item.h:35

References ApplyEquipSpell(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), GetAttackBySlot(), INVENTORY_SLOT_BAG_END, ItemSetEff, m_items, MAX_ITEM_SET_SPELLS, ItemSetEffect::spells, and sScriptMgr.

Referenced by InitDataForForm().

◆ UpdateExpertise()

void Player::UpdateExpertise ( WeaponAttackType  attType)
895{
896 if (attack == RANGED_ATTACK)
897 return;
898
899 float expertise = GetRatingBonusValue(CR_EXPERTISE);
900
901 Item* weapon = GetWeaponForAttack(attack, true);
902
904 for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
905 {
906 // item neutral spell
907 if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
908 expertise += (*itr)->GetAmount();
909 // item dependent spell
910 else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
911 expertise += (*itr)->GetAmount();
912 }
913
914 if (expertise < 0)
915 expertise = 0;
916
917 switch (attack)
918 {
919 case BASE_ATTACK:
920 m_Expertise = expertise;
922 break;
923 case OFF_ATTACK:
924 m_OffhandExpertise = expertise;
926 break;
927 default:
928 break;
929 }
930}
@ SPELL_AURA_MOD_EXPERTISE
Definition SpellAuraDefines.h:303
@ PLAYER_EXPERTISE
Definition UpdateFields.h:349
@ PLAYER_OFFHAND_EXPERTISE
Definition UpdateFields.h:350

References BASE_ATTACK, CR_EXPERTISE, Unit::GetAuraEffectsByType(), GetRatingBonusValue(), GetWeaponForAttack(), Item::IsFitToSpellRequirements(), m_Expertise, m_OffhandExpertise, OFF_ATTACK, PLAYER_EXPERTISE, PLAYER_OFFHAND_EXPERTISE, RANGED_ATTACK, Unit::SetUInt32Value(), and SPELL_AURA_MOD_EXPERTISE.

Referenced by DestroyItem(), EquipItem(), AuraEffect::HandleAuraModExpertise(), RemoveItem(), UpdateAllStats(), and UpdateRating().

◆ UpdateFallInformationIfNeed()

void Player::UpdateFallInformationIfNeed ( MovementInfo const &  minfo,
uint16  opcode 
)
2190{
2191 if (m_lastFallTime >= minfo.fallTime ||
2192 m_lastFallZ <= minfo.pos.GetPositionZ() || opcode == MSG_MOVE_FALL_LAND)
2193 SetFallInformation(minfo.fallTime, minfo.pos.GetPositionZ());
2194}
@ MSG_MOVE_FALL_LAND
Definition Opcodes.h:231

References MovementInfo::fallTime, Position::GetPositionZ(), m_lastFallTime, m_lastFallZ, MSG_MOVE_FALL_LAND, MovementInfo::pos, and SetFallInformation().

Referenced by WorldSession::HandleMovementOpcodes().

◆ UpdateFFAPvPFlag()

void Player::UpdateFFAPvPFlag ( time_t  currTime)
392{
393 if (!IsFFAPvP() || sWorld->IsFFAPvPRealm() || !pvpInfo.FFAPvPEndTimer || currTime < pvpInfo.FFAPvPEndTimer + 30)
394 {
395 return;
396 }
397
398 pvpInfo.FFAPvPEndTimer = time_t(0);
400 {
402 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
403 }
404 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
405 (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
406
407 // xinef: iterate attackers
408 AttackerSet toRemove;
409 AttackerSet const& attackers = getAttackers();
410 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr)
411 if (!(*itr)->IsValidAttackTarget(this))
412 toRemove.insert(*itr);
413
414 for (AttackerSet::const_iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr)
415 (*itr)->AttackStop();
416
417 // xinef: remove our own victim
418 if (Unit* victim = GetVictim())
419 if (!IsValidAttackTarget(victim))
420 AttackStop();
421}
std::unordered_set< Unit * > AttackerSet
Definition Unit.h:622
AttackerSet const & getAttackers() const
Definition Unit.h:845
time_t FFAPvPEndTimer
‍Time when player unflags himself for PvP (flag removed after 5 minutes)
Definition Player.h:371

References Unit::AttackStop(), PvPInfo::FFAPvPEndTimer, Unit::getAttackers(), Unit::GetVictim(), Object::HasByteFlag(), IsFFAPvP(), Unit::IsValidAttackTarget(), Unit::m_Controlled, pvpInfo, Object::RemoveByteFlag(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, and UNIT_FIELD_BYTES_2.

Referenced by Update().

◆ UpdateFFAPvPState()

void Player::UpdateFFAPvPState ( bool  reset = true)
Todo:
: should we always synchronize UNIT_FIELD_BYTES_2, 1 of controller
1458{
1460 // and controlled? no, we shouldn't, those are checked for affecting player
1461 // by client
1462 if (!pvpInfo.IsInNoPvPArea && !IsGameMaster() &&
1463 (pvpInfo.IsInFFAPvPArea || sWorld->IsFFAPvPRealm()))
1464 {
1465 if (!IsFFAPvP())
1466 {
1467 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
1469 for (ControlSet::iterator itr = m_Controlled.begin();
1470 itr != m_Controlled.end(); ++itr)
1471 (*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1,
1473 }
1474
1476 {
1477 pvpInfo.FFAPvPEndTimer = time_t(0);
1478 }
1479 }
1480 else if (IsFFAPvP())
1481 {
1482 if ((pvpInfo.IsInNoPvPArea || IsGameMaster()) || reset ||
1484 {
1485 pvpInfo.FFAPvPEndTimer = time_t(0);
1487 {
1489 sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
1490 }
1491 for (ControlSet::iterator itr = m_Controlled.begin();
1492 itr != m_Controlled.end(); ++itr)
1493 (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1,
1495
1496 // xinef: iterate attackers
1497 AttackerSet toRemove;
1498 AttackerSet const& attackers = getAttackers();
1499 for (AttackerSet::const_iterator itr = attackers.begin();
1500 itr != attackers.end(); ++itr)
1501 if (!(*itr)->IsValidAttackTarget(this))
1502 toRemove.insert(*itr);
1503
1504 for (AttackerSet::const_iterator itr = toRemove.begin();
1505 itr != toRemove.end(); ++itr)
1506 (*itr)->AttackStop();
1507
1508 // xinef: remove our own victim
1509 if (Unit* victim = GetVictim())
1510 if (!IsValidAttackTarget(victim))
1511 AttackStop();
1512 }
1513 else
1514 {
1515 // Not in FFA PvP Area
1516 // Not FFA PvP realm
1517 // Not FFA PvP timer already set
1518 // Being recently in PvP combat
1519 if (!pvpInfo.IsInFFAPvPArea && !sWorld->IsFFAPvPRealm() &&
1521 {
1523 GameTime::GetGameTime().count() +
1524 sWorld->getIntConfig(CONFIG_FFA_PVP_TIMER);
1525 }
1526 }
1527 }
1528}
@ CONFIG_FFA_PVP_TIMER
Definition WorldConfig.h:370
time_t EndTimer
‍Marks if player is in an FFAPvP area (such as Gurubashi Arena)
Definition Player.h:370

References Unit::AttackStop(), CONFIG_FFA_PVP_TIMER, PvPInfo::EndTimer, PvPInfo::FFAPvPEndTimer, Unit::getAttackers(), GameTime::GetGameTime(), Unit::GetVictim(), Object::HasByteFlag(), IsFFAPvP(), IsGameMaster(), PvPInfo::IsInFFAPvPArea, PvPInfo::IsInNoPvPArea, Unit::IsValidAttackTarget(), Unit::m_Controlled, pvpInfo, Object::RemoveByteFlag(), Object::SetByteFlag(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, and UNIT_FIELD_BYTES_2.

Referenced by UpdateArea(), and UpdatePvPState().

◆ UpdateFishingSkill()

bool Player::UpdateFishingSkill ( )
887{
888 LOG_DEBUG("entities.player.skills", "UpdateFishingSkill");
889
891
892 if (SkillValue >= GetMaxSkillValue(SKILL_FISHING))
893 {
894 return false;
895 }
896
897 /* Whenever the player clicks on the fishing gameobject the
898 * core will decide based on a probability if the skill raises or not.
899 */
900 return UpdateSkillPro(
902 static_cast<int32>(getProbabilityOfLevelUp(SkillValue)) * 10,
903 sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING));
904}
float getProbabilityOfLevelUp(uint32 SkillValue)
Definition PlayerUpdates.cpp:865
@ CONFIG_SKILL_GAIN_GATHERING
Definition WorldConfig.h:222
uint16 GetMaxSkillValue(uint32 skill) const
Definition Player.cpp:5500

References CONFIG_SKILL_GAIN_GATHERING, GetMaxSkillValue(), getProbabilityOfLevelUp(), GetPureSkillValue(), LOG_DEBUG, SKILL_FISHING, sWorld, and UpdateSkillPro().

Referenced by GameObject::Use().

◆ UpdateForQuestWorldObjects()

void Player::UpdateForQuestWorldObjects ( )

This code doesn't look right, but it was logically converted to condition system to do the exact same thing it did before. It definitely needs to be overlooked for intended functionality.

1794{
1795 if (GetObjectVisibilityContainer().GetVisibleWorldObjectsMap()->empty())
1796 return;
1797
1798 UpdateData udata;
1799 DoForAllVisibleWorldObjects([this, &udata](WorldObject* worldObject)
1800 {
1801 if (worldObject->IsGameObject())
1802 {
1803 if (GameObject* obj = worldObject->ToGameObject())
1804 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1805 }
1806 else if (worldObject->IsCreature())
1807 {
1808 Creature* obj = worldObject->ToCreature();
1809 if (!obj)
1810 return;
1811
1812 // check if this unit requires quest specific flags
1813 if (obj->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
1814 {
1815 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry());
1816 for (SpellClickInfoContainer::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr)
1817 {
1820 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId);
1821 bool buildUpdateBlock = false;
1822 for (ConditionList::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr)
1823 if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN)
1824 buildUpdateBlock = true;
1825
1826 if (buildUpdateBlock)
1827 {
1828 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1829 break;
1830 }
1831 }
1832 }
1833 else if (obj->HasNpcFlag(UNIT_NPC_FLAG_VENDOR_MASK | UNIT_NPC_FLAG_TRAINER))
1834 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1835 }
1836 });
1837
1838 if (!udata.HasData())
1839 return;
1840
1841 WorldPacket packet;
1842 udata.BuildPacket(packet);
1843 GetSession()->SendPacket(&packet);
1844}
@ UNIT_NPC_FLAG_VENDOR_MASK
Definition UnitDefines.h:343
Definition UpdateData.h:52
bool HasData() const
Definition UpdateData.h:60
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48

References WorldObject::DoForAllVisibleWorldObjects(), WorldObject::GetObjectVisibilityContainer(), Object::IsCreature(), Object::IsGameObject(), UNIT_NPC_FLAG_TRAINER, and UNIT_NPC_FLAG_VENDOR_MASK.

Referenced by Group::AddMember(), Group::Disband(), EquipItem(), ItemAddedQuestCheck(), ItemRemovedQuestCheck(), Group::RemoveMember(), and SendQuestUpdate().

◆ UpdateGatherSkill()

bool Player::UpdateGatherSkill ( uint32  SkillId,
uint32  SkillValue,
uint32  RedLevel,
uint32  Multiplicator = 1 
)
764{
765 LOG_DEBUG("entities.player.skills",
766 "UpdateGatherSkill(SkillId {} SkillLevel {} RedLevel {})",
767 SkillId, SkillValue, RedLevel);
768
769 uint32 gathering_skill_gain =
770 sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
771 sScriptMgr->OnPlayerUpdateGatheringSkill(this, SkillId, SkillValue, RedLevel + 100, RedLevel + 50, RedLevel + 25, gathering_skill_gain);
772
773 // For skinning and Mining chance decrease with level. 1-74 - no decrease,
774 // 75-149 - 2 times, 225-299 - 8 times
775 switch (SkillId)
776 {
777 case SKILL_HERBALISM:
781 return UpdateSkillPro(SkillId,
782 SkillGainChance(SkillValue, RedLevel + 100,
783 RedLevel + 50, RedLevel + 25) *
784 Multiplicator,
785 gathering_skill_gain);
786 case SKILL_SKINNING:
787 if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS) == 0)
788 return UpdateSkillPro(SkillId,
789 SkillGainChance(SkillValue, RedLevel + 100,
790 RedLevel + 50,
791 RedLevel + 25) *
792 Multiplicator,
793 gathering_skill_gain);
794 else
795 return UpdateSkillPro(
796 SkillId,
797 (SkillGainChance(SkillValue, RedLevel + 100, RedLevel + 50,
798 RedLevel + 25) *
799 Multiplicator) >>
800 (SkillValue /
802 gathering_skill_gain);
803 case SKILL_MINING:
804 if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_MINING_STEPS) == 0)
805 return UpdateSkillPro(SkillId,
806 SkillGainChance(SkillValue, RedLevel + 100,
807 RedLevel + 50,
808 RedLevel + 25) *
809 Multiplicator,
810 gathering_skill_gain);
811 else
812 return UpdateSkillPro(
813 SkillId,
814 (SkillGainChance(SkillValue, RedLevel + 100, RedLevel + 50,
815 RedLevel + 25) *
816 Multiplicator) >>
817 (SkillValue /
819 gathering_skill_gain);
820 }
821 return false;
822}
@ SKILL_INSCRIPTION
Definition SharedDefines.h:3241
@ SKILL_MINING
Definition SharedDefines.h:3158
@ SKILL_SKINNING
Definition SharedDefines.h:3200
@ SKILL_JEWELCRAFTING
Definition SharedDefines.h:3224
@ SKILL_HERBALISM
Definition SharedDefines.h:3154
@ CONFIG_SKILL_CHANCE_SKINNING_STEPS
Definition WorldConfig.h:219
@ CONFIG_SKILL_CHANCE_MINING_STEPS
Definition WorldConfig.h:218

References CONFIG_SKILL_CHANCE_MINING_STEPS, CONFIG_SKILL_CHANCE_SKINNING_STEPS, CONFIG_SKILL_GAIN_GATHERING, LOG_DEBUG, SKILL_HERBALISM, SKILL_INSCRIPTION, SKILL_JEWELCRAFTING, SKILL_LOCKPICKING, SKILL_MINING, SKILL_SKINNING, SkillGainChance(), sScriptMgr, sWorld, and UpdateSkillPro().

Referenced by Spell::EffectMilling(), Spell::EffectOpenLock(), Spell::EffectProspecting(), Spell::EffectSkinning(), and GetExplicitDiscoverySpell().

◆ UpdateHomebindTime()

void Player::UpdateHomebindTime ( uint32  time)
1398{
1399 // GMs never get homebind timer online
1401 {
1402 if (m_HomebindTimer) // instance valid, but timer not reset
1403 {
1404 // hide reminder
1405 WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
1406 data << uint32(0);
1407 data << uint32(0);
1408 GetSession()->SendPacket(&data);
1409 }
1410 // instance is valid, reset homebind timer
1411 m_HomebindTimer = 0;
1412 }
1413 else if (m_HomebindTimer > 0)
1414 {
1415 if (time >= m_HomebindTimer)
1416 {
1417 // teleport to nearest graveyard
1419 }
1420 else
1421 m_HomebindTimer -= time;
1422 }
1423 else
1424 {
1425 // instance is invalid, start homebind timer
1426 m_HomebindTimer = 60000;
1427 // send message to player
1428 WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
1429 data << uint32(m_HomebindTimer);
1430 data << uint32(1);
1431 GetSession()->SendPacket(&data);
1432 LOG_DEBUG(
1433 "maps",
1434 "PLAYER: Player '{}' ({}) will be teleported to homebind in 60 "
1435 "seconds",
1436 GetName(), GetGUID().ToString());
1437 }
1438}
@ SMSG_RAID_GROUP_ONLY
Definition Opcodes.h:676

References Object::GetGUID(), WorldObject::GetName(), GetSession(), IsGameMaster(), LOG_DEBUG, m_HomebindTimer, m_InstanceValid, RepopAtGraveyard(), WorldSession::SendPacket(), SMSG_RAID_GROUP_ONLY, and Position::ToString().

Referenced by Update().

◆ UpdateHonorFields()

void Player::UpdateHonorFields ( )

called when rewarding honor and at each save

1183{
1185 time_t now = time_t(GameTime::GetGameTime().count());
1186 time_t today = time_t(GameTime::GetGameTime().count() / DAY) * DAY;
1187
1188 if (m_lastHonorUpdateTime < today)
1189 {
1190 time_t yesterday = today - DAY;
1191
1193
1194 // update yesterday's contribution
1195 if (m_lastHonorUpdateTime >= yesterday)
1196 {
1199
1200 // this is the first update today, reset today's contribution
1203 }
1204 else
1205 {
1206 // no honor/kills yesterday or today, reset
1209 }
1210 }
1211
1213}
uint16 PAIR32_LOPART(uint32 x)
Definition ObjectDefines.h:99

References DAY, GameTime::GetGameTime(), Object::GetUInt32Value(), m_lastHonorUpdateTime, MAKE_PAIR32(), PAIR32_LOPART(), PLAYER_FIELD_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, and Unit::SetUInt32Value().

Referenced by honor_commandscript::HandleHonorUpdateCommand(), LoadFromDB(), RewardHonor(), and SaveToDB().

◆ UpdateInvisibilityDrunkDetect()

void Player::UpdateInvisibilityDrunkDetect ( )
1007{
1008 // select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
1009 uint8 drunkValue = GetDrunkValue();
1010 int32 fakeDrunkValue = GetFakeDrunkValue();
1011 int32 maxDrunkValue = std::max<int32>(drunkValue, fakeDrunkValue);
1012
1013 if (maxDrunkValue != 0)
1014 {
1017 }
1018 else
1020
1022}
@ INVISIBILITY_DRUNK
Definition SharedDefines.h:1261
void AddFlag(FLAG_TYPE flag)
Definition Object.h:380
void DelFlag(FLAG_TYPE flag)
Definition Object.h:381
int32 GetFakeDrunkValue() const
Definition Player.h:2190
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:600

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetDrunkValue(), GetFakeDrunkValue(), INVISIBILITY_DRUNK, WorldObject::m_invisibilityDetect, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by AuraEffect::HandleAuraModFakeInebriation(), and SetDrunkValue().

◆ UpdateItemDuration()

void Player::UpdateItemDuration ( uint32  time,
bool  realtimeonly = false 
)
4146{
4147 if (m_itemDuration.empty())
4148 return;
4149
4150 LOG_DEBUG("entities.player.items", "Player::UpdateItemDuration({}, {})", time, realtimeonly);
4151
4152 for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end();)
4153 {
4154 Item* item = *itr;
4155 ++itr; // current element can be erased in UpdateDuration
4156
4157 if (!realtimeonly || item->GetTemplate()->HasFlagCu(ITEM_FLAGS_CU_DURATION_REAL_TIME))
4158 item->UpdateDuration(this, time);
4159 }
4160}
@ ITEM_FLAGS_CU_DURATION_REAL_TIME
Definition ItemTemplate.h:219
void UpdateDuration(Player *owner, uint32 diff)
Definition Item.cpp:318
bool HasFlagCu(ItemFlagsCustom flag) const
Definition ItemTemplate.h:828

References Item::GetTemplate(), ItemTemplate::HasFlagCu(), ITEM_FLAGS_CU_DURATION_REAL_TIME, LOG_DEBUG, m_itemDuration, and Item::UpdateDuration().

Referenced by LoadFromDB(), and Update().

◆ UpdateLFGChannel()

void Player::UpdateLFGChannel ( )
465{
466 if (!sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL))
467 return;
468
470 if (!cMgr)
471 return;
472
473 ChatChannelsEntry const* cce = sChatChannelsStore.LookupEntry(26); /*LookingForGroup*/
475 if (!cLFG)
476 return;
477
478 Channel* cUsed = nullptr;
479 for (Channel* channel : m_channels)
480 if (channel && channel->GetChannelId() == cce->ChannelID)
481 {
482 cUsed = cLFG;
483 break;
484 }
485
486 if (IsUsingLfg())
487 {
488 if (cUsed == cLFG)
489 return;
490
491 cLFG->JoinChannel(this, "");
492 }
493 else
494 {
495 if (cLFG != cUsed)
496 return;
497
498 cLFG->LeaveChannel(this, true);
499 }
500}
DBCStorage< ChatChannelsEntry > sChatChannelsStore(ChatChannelsEntryfmt)
@ CONFIG_RESTRICTED_LFG_CHANNEL
Definition WorldConfig.h:57
Definition ChannelMgr.h:29
static ChannelMgr * forTeam(TeamId teamId)
Definition ChannelMgr.cpp:33
Channel * GetJoinChannel(std::string const &name, uint32 channel_id)
Definition ChannelMgr.cpp:121
void JoinChannel(Player *player, std::string const &pass)
Definition Channel.cpp:157
bool IsUsingLfg()
Definition Player.cpp:13034
LocaleConstant GetSessionDbcLocale() const
Definition WorldSession.h:516
Definition DBCStructure.h:643
uint32 ChannelID
Definition DBCStructure.h:644
char const * pattern[16]
Definition DBCStructure.h:646

References ChatChannelsEntry::ChannelID, CONFIG_RESTRICTED_LFG_CHANNEL, ChannelMgr::forTeam(), ChannelMgr::GetJoinChannel(), WorldSession::GetSessionDbcLocale(), GetTeamId(), IsUsingLfg(), Channel::JoinChannel(), Channel::LeaveChannel(), m_channels, m_session, ChatChannelsEntry::pattern, sChatChannelsStore, and sWorld.

Referenced by WorldSession::HandleLfgJoinOpcode(), and WorldSession::HandleLfgLeaveOpcode().

◆ UpdateLocalChannels()

void Player::UpdateLocalChannels ( uint32  newZone)
503{
504 // pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE)
505 static std::mutex channelsLock;
506 std::lock_guard<std::mutex> guard(channelsLock);
507
508 if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar())
509 return; // The client handles it automatically after loading, but not
510 // after teleporting
511
512 AreaTableEntry const* current_zone = sAreaTableStore.LookupEntry(newZone);
513 if (!current_zone)
514 return;
515
517 if (!cMgr)
518 return;
519
520 std::string current_zone_name =
521 current_zone->area_name[GetSession()->GetSessionDbcLocale()];
522
523 for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
524 {
525 if (ChatChannelsEntry const* channel =
526 sChatChannelsStore.LookupEntry(i))
527 {
528 Channel* usedChannel = nullptr;
529
530 for (Channel* channel : m_channels)
531 {
532 if (channel && channel->GetChannelId() == i)
533 {
534 usedChannel = channel;
535 break;
536 }
537 }
538
539 Channel* removeChannel = nullptr;
540 Channel* joinChannel = nullptr;
541 bool sendRemove = true;
542
543 if (CanJoinConstantChannelInZone(channel, current_zone))
544 {
545 if (!(channel->flags & CHANNEL_DBC_FLAG_GLOBAL))
546 {
547 if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY &&
548 usedChannel)
549 continue; // Already on the channel, as city channel
550 // names are not changing
551
552 char new_channel_name_buf[100];
553 std::string currentNameExt;
554
555 if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY)
556 currentNameExt = sObjectMgr->GetAcoreStringForDBCLocale(LANG_CHANNEL_CITY);
557 else
558 currentNameExt = current_zone_name;
559
560 snprintf(new_channel_name_buf, 100,
561 channel->pattern[m_session->GetSessionDbcLocale()],
562 currentNameExt.c_str());
563
564 joinChannel = cMgr->GetJoinChannel(new_channel_name_buf,
565 channel->ChannelID);
566 if (usedChannel)
567 {
568 if (joinChannel != usedChannel)
569 {
570 removeChannel = usedChannel;
571 sendRemove = false; // Do not send leave channel, it
572 // already replaced at client
573 }
574 else
575 joinChannel = nullptr;
576 }
577 }
578 else
579 joinChannel = cMgr->GetJoinChannel(
580 channel->pattern[m_session->GetSessionDbcLocale()],
581 channel->ChannelID);
582 }
583 else
584 removeChannel = usedChannel;
585
586 if (joinChannel)
587 joinChannel->JoinChannel(
588 this, ""); // Changed Channel: ... or Joined Channel: ...
589
590 if (removeChannel)
591 {
592 removeChannel->LeaveChannel(this,
593 sendRemove); // Leave old channel
594 std::string name =
595 removeChannel
596 ->GetName(); // Store name, (*i)erase in LeftChannel
597 LeftChannel(removeChannel); // Remove from player's channel list
598 }
599 }
600 }
601}
@ CHANNEL_DBC_FLAG_GLOBAL
Definition Channel.h:95
@ LANG_CHANNEL_CITY
Definition Language.h:764
std::string const & GetName() const
Definition Channel.h:179
void LeftChannel(Channel *c)
Definition Player.cpp:5030
bool CanJoinConstantChannelInZone(ChatChannelsEntry const *channel, AreaTableEntry const *zone)
Definition Player.cpp:5007
char const * area_name[16]
Definition DBCStructure.h:527

References AreaTableEntry::area_name, CanJoinConstantChannelInZone(), CHANNEL_DBC_FLAG_CITY_ONLY, CHANNEL_DBC_FLAG_GLOBAL, ChannelMgr::forTeam(), ChannelMgr::GetJoinChannel(), Channel::GetName(), GetSession(), WorldSession::GetSessionDbcLocale(), GetTeamId(), IsBeingTeleportedFar(), Channel::JoinChannel(), LANG_CHANNEL_CITY, Channel::LeaveChannel(), LeftChannel(), m_channels, m_session, sAreaTableStore, sChatChannelsStore, and sObjectMgr.

Referenced by UpdateZone().

◆ UpdateLootAchievements()

void Player::UpdateLootAchievements ( LootItem item,
Loot loot 
)

◆ UpdateManaRegen()

void Player::UpdateManaRegen ( )
944{
946 {
949 return;
950 }
951
952 float Intellect = GetStat(STAT_INTELLECT);
953 // Mana regen from spirit and intellect
954 float power_regen = std::sqrt(Intellect) * OCTRegenMPPerSpirit();
955 // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
957
958 // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
960
961 // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
963 for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
964 {
965 power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
966 }
967
968 // Set regen rate in cast state apply only on spirit based regen
970 if (modManaRegenInterrupt > 100)
971 modManaRegenInterrupt = 100;
972 SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER + AsUnderlyingType(POWER_MANA), power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
973
975}
@ SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
Definition SpellAuraDefines.h:197
@ SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
Definition SpellAuraDefines.h:282
float OCTRegenMPPerSpirit()
Definition Player.cpp:5273

References AsUnderlyingType(), CalculatePct(), Unit::GetAuraEffectsByType(), Unit::GetStat(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierByMiscValue(), Unit::GetTotalAuraMultiplierByMiscValue(), Unit::HasAuraTypeWithMiscvalue(), m_baseManaRegen, OCTRegenMPPerSpirit(), POWER_MANA, Object::SetStatFloatValue(), SPELL_AURA_MOD_MANA_REGEN_FROM_STAT, SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_POWER_REGEN_PERCENT, SPELL_AURA_PREVENT_REGENERATE_POWER, STAT_INTELLECT, UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, and UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER.

Referenced by ApplyManaRegenBonus(), AuraEffect::HandleModManaRegen(), AuraEffect::HandleModPowerRegen(), UpdateAllStats(), and UpdateStats().

◆ UpdateMaxHealth()

void Player::UpdateMaxHealth ( )
overridevirtual

Implements Unit.

314{
315 UnitMods unitMod = UNIT_MOD_HEALTH;
316
317 float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
318 value *= GetModifierValue(unitMod, BASE_PCT);
320 value *= GetModifierValue(unitMod, TOTAL_PCT);
321
322 sScriptMgr->OnPlayerAfterUpdateMaxHealth(this, value);
323 SetMaxHealth((uint32)value);
324}
float GetHealthBonusFromStamina()
Definition StatSystem.cpp:293

References BASE_PCT, BASE_VALUE, Unit::GetCreateHealth(), GetHealthBonusFromStamina(), Unit::GetModifierValue(), Unit::SetMaxHealth(), sScriptMgr, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_HEALTH.

Referenced by UpdateAllStats(), and UpdateStats().

◆ UpdateMaxPower()

void Player::UpdateMaxPower ( Powers  power)
overridevirtual

Implements Unit.

327{
328 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + power);
329
330 float bonusPower = (power == POWER_MANA && GetCreatePowers(power) > 0) ? GetManaBonusFromIntellect() : 0;
331
332 float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
333 value *= GetModifierValue(unitMod, BASE_PCT);
334 value += GetModifierValue(unitMod, TOTAL_VALUE) + bonusPower;
335 value *= GetModifierValue(unitMod, TOTAL_PCT);
336
337 sScriptMgr->OnPlayerAfterUpdateMaxPower(this, power, value);
338 SetMaxPower(power, uint32(value));
339}
@ UNIT_MOD_POWER_START
Definition Unit.h:175
float GetManaBonusFromIntellect()
Definition StatSystem.cpp:303

References BASE_PCT, BASE_VALUE, Unit::GetCreatePowers(), GetManaBonusFromIntellect(), Unit::GetModifierValue(), POWER_MANA, Unit::SetMaxPower(), sScriptMgr, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_POWER_START.

Referenced by Create(), UpdateAllStats(), and UpdateStats().

◆ UpdateMeleeHitChances()

void Player::UpdateMeleeHitChances ( )

◆ UpdateMirrorTimers()

void Player::UpdateMirrorTimers ( )
430{
431 // Desync flags for update on next HandleDrowning
433 m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags;
434}

References m_MirrorTimerFlags, and m_MirrorTimerFlagsLast.

Referenced by AuraEffect::HandleWaterBreathing().

◆ UpdateNextMailTimeAndUnreads()

void Player::UpdateNextMailTimeAndUnreads ( )
437{
438 // Update the next delivery time and unread mails
439 time_t cTime = GameTime::GetGameTime().count();
440
442 unReadMails = 0;
443
444 for (Mail const* mail : GetMails())
445 {
446 if (mail->deliver_time > cTime)
447 {
448 if (!m_nextMailDelivereTime || m_nextMailDelivereTime > mail->deliver_time)
449 m_nextMailDelivereTime = mail->deliver_time;
450 }
451
452 // must be not checked yet
453 if (mail->checked & MAIL_CHECK_MASK_READ)
454 continue;
455
456 // and already delivered or expired
457 if (cTime < mail->deliver_time || cTime > mail->expire_time)
458 continue;
459
460 unReadMails++;
461 }
462}
@ MAIL_CHECK_MASK_READ
Definition Mail.h:47
PlayerMails const & GetMails() const
Definition Player.h:1665

References GameTime::GetGameTime(), GetMails(), m_nextMailDelivereTime, MAIL_CHECK_MASK_READ, and unReadMails.

Referenced by _LoadMail(), and WorldSession::HandleGetMailList().

◆ UpdateObjectVisibility()

void Player::UpdateObjectVisibility ( bool  forced = true,
bool  fromUpdate = false 
)
overridevirtual

Reimplemented from WorldObject.

1618{
1619 // Prevent updating visibility if player is not in world (example: LoadFromDB sets drunkstate which updates invisibility while player is not in map)
1620 if (!IsInWorld())
1621 return;
1622
1623 if (!forced)
1625 else if (!isBeingLoaded())
1626 {
1627 if (!fromUpdate) // pussywizard:
1628 {
1630 return;
1631 }
1634 }
1635}
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:19218
void AddToNotify(uint16 f)
Definition Object.cpp:2929

References WorldObject::AddToNotify(), Unit::bRequestForcedVisibilityUpdate, isBeingLoaded(), Object::IsInWorld(), NOTIFY_VISIBILITY_CHANGED, Unit::UpdateObjectVisibility(), and UpdateVisibilityForPlayer().

Referenced by Map::AddPlayerToMap(), gm_commandscript::HandleGMVisibleCommand(), WorldSession::HandlePlayerLoginToCharInWorld(), Map::PlayerRelocation(), ResurrectPlayer(), SetGameMaster(), SetGroup(), Update(), and UpdateInvisibilityDrunkDetect().

◆ UpdateParryPercentage()

void Player::UpdateParryPercentage ( )
753{
754 const float parry_cap[MAX_CLASSES] =
755 {
756 47.003525f, // Warrior
757 47.003525f, // Paladin
758 145.560408f, // Hunter
759 145.560408f, // Rogue
760 0.0f, // Priest
761 47.003525f, // DK
762 145.560408f, // Shaman
763 0.0f, // Mage
764 0.0f, // Warlock
765 0.0f, // ??
766 0.0f // Druid
767 };
768
769 // No parry
770 float value = 0.0f;
771 m_realParry = 0.0f;
772 uint32 pclass = getClass() - 1;
773 if (CanParry() && parry_cap[pclass] > 0.0f)
774 {
775 float nondiminishing = 5.0f;
776 // Parry from rating
777 float diminishing = GetRatingBonusValue(CR_PARRY);
778 // Modify value from defense skill (only bonus from defense rating diminishes)
779 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
780 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
781 // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
783 // apply diminishing formula to diminishing parry chance
784 m_realParry = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
785 m_realParry = m_realParry < 0.0f ? 0.0f : m_realParry;
786
787 value = std::max(diminishing + nondiminishing, 0.0f);
788
789 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
790 {
791 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Parry", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Parry", 95.0f) : value;
792 }
793 }
794
796}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition SpellAuraDefines.h:110
bool CanParry() const
Definition Player.h:2201

References CanParry(), CR_DEFENSE_SKILL, CR_PARRY, Unit::getClass(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), Unit::GetTotalAuraModifier(), m_diminishing_k, m_realParry, MAX_CLASSES, PLAYER_PARRY_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), SKILL_DEFENSE, and SPELL_AURA_MOD_PARRY_PERCENT.

Referenced by AuraEffect::HandleAuraModParryPercent(), SetCanParry(), UpdateDefenseBonusesMod(), and UpdateRating().

◆ UpdatePlayerSetting()

void Player::UpdatePlayerSetting ( std::string const &  source,
uint8  index,
uint32  value 
)
99{
100 auto it = m_charSettingsMap.find(source);
101 size_t const requiredSize = static_cast<size_t>(index) + 1;
102
103 if (it == m_charSettingsMap.end())
104 {
105 // Settings not found, create new vector of appropriate size
106 PlayerSettingVector settings(requiredSize); // default-initialized PlayerSetting
107 settings[index].value = value;
108
109 m_charSettingsMap.emplace(source, std::move(settings));
110 }
111 else
112 {
113 PlayerSettingVector& settings = it->second;
114 if (settings.size() < requiredSize)
115 settings.resize(requiredSize); // new elements default to zero
116
117 settings[index].value = value;
118 }
119}

References m_charSettingsMap.

Referenced by GetPlayerSetting(), and player_settings_commandscript::HandleSettingsAnnouncerFlags().

◆ UpdatePosition() [1/2]

bool Player::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline
2040{ return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
bool UpdatePosition(float x, float y, float z, float orientation, bool teleport=false) override
Definition PlayerUpdates.cpp:1156

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and UpdatePosition().

Referenced by UpdatePosition().

◆ UpdatePosition() [2/2]

bool Player::UpdatePosition ( float  x,
float  y,
float  z,
float  orientation,
bool  teleport = false 
)
overridevirtual

Reimplemented from Unit.

1158{
1159 if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
1160 return false;
1161
1162 // Update player zone if needed
1163 if (m_needZoneUpdate)
1164 {
1165 uint32 newZone, newArea;
1166 GetZoneAndAreaId(newZone, newArea);
1167 UpdateZone(newZone, newArea);
1168 m_needZoneUpdate = false;
1169 }
1170
1171 if (GetGroup())
1173
1176
1178
1179 return true;
1180}
@ GROUP_UPDATE_FLAG_POSITION
Definition Group.h:108
@ TRADE_STATUS_TRADE_CANCELED
Definition SharedDefines.h:3808
void CheckAreaExploreAndOutdoor()
Definition Player.cpp:5748
Player * GetTrader() const
Definition Player.h:1391
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:19846

References CheckAreaExploreAndOutdoor(), GetGroup(), GetSession(), GetTrader(), WorldObject::GetZoneAndAreaId(), GROUP_UPDATE_FLAG_POSITION, INTERACTION_DISTANCE, WorldObject::IsWithinDistInMap(), m_needZoneUpdate, WorldSession::SendCancelTrade(), SetGroupUpdateFlag(), TRADE_STATUS_TRADE_CANCELED, Unit::UpdatePosition(), and UpdateZone().

Referenced by spell_rog_killing_spree_aura::HandleEffectPeriodic(), and WorldSession::HandleMoveTeleportAck().

◆ UpdatePotionCooldown()

void Player::UpdatePotionCooldown ( Spell spell = nullptr)
1548{
1549 // no potion used i combat or still in combat
1550 if (!GetLastPotionId() || IsInCombat())
1551 return;
1552
1553 // Call not from spell cast, send cooldown event for item spells if no in
1554 // combat
1555 if (!spell)
1556 {
1557 // spell/item pair let set proper cooldown (except not existed charged
1558 // spell cooldown spellmods for potions)
1559 if (ItemTemplate const* proto =
1560 sObjectMgr->GetItemTemplate(GetLastPotionId()))
1561 for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
1562 if (proto->Spells[idx].SpellId &&
1563 proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
1564 if (SpellInfo const* spellInfo =
1565 sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId))
1566 SendCooldownEvent(spellInfo, GetLastPotionId());
1567 }
1568 // from spell cases (m_lastPotionId set in Spell::SendSpellCooldown)
1569 else
1570 {
1571 if (spell->IsIgnoringCooldowns())
1572 return;
1573
1575 }
1576
1577 SetLastPotionId(0);
1578}
void SetLastPotionId(uint32 item_id)
Definition Player.h:1826
uint32 GetLastPotionId()
Definition Player.h:1825
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11086
bool IsIgnoringCooldowns() const
Definition Spell.cpp:8092

References GetLastPotionId(), Spell::IsIgnoringCooldowns(), Unit::IsInCombat(), ITEM_SPELLTRIGGER_ON_USE, m_lastPotionId, Spell::m_spellInfo, MAX_ITEM_SPELLS, SendCooldownEvent(), SetLastPotionId(), sObjectMgr, and sSpellMgr.

Referenced by Spell::finish().

◆ UpdatePvP()

void Player::UpdatePvP ( bool  state,
bool  _override = false 
)

◆ UpdatePvPFlag()

void Player::UpdatePvPFlag ( time_t  currTime)
373{
374 if (!IsPvP())
375 return;
376
377 if (pvpInfo.EndTimer == 0 || pvpInfo.IsHostile)
378 return;
379
380 if (currTime < (pvpInfo.EndTimer + 300 + 5))
381 {
382 if (currTime > (pvpInfo.EndTimer + 4) && !HasPlayerFlag(PLAYER_FLAGS_PVP_TIMER))
384
385 return;
386 }
387
388 UpdatePvP(false);
389}
void UpdatePvP(bool state, bool _override=false)
Definition PlayerUpdates.cpp:1530

References PvPInfo::EndTimer, HasPlayerFlag(), PvPInfo::IsHostile, IsPvP(), PLAYER_FLAGS_PVP_TIMER, pvpInfo, SetPlayerFlag(), and UpdatePvP().

Referenced by Update().

◆ UpdatePvPState()

void Player::UpdatePvPState ( )
1441{
1443
1444 if (pvpInfo.IsHostile) // in hostile area
1445 {
1446 if (!IsPvP() || pvpInfo.EndTimer != 0)
1447 UpdatePvP(true, true);
1448 }
1449 else // in friendly area
1450 {
1452 pvpInfo.EndTimer == 0)
1453 pvpInfo.EndTimer = GameTime::GetGameTime().count(); // start toggle-off
1454 }
1455}
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:489

References PvPInfo::EndTimer, GameTime::GetGameTime(), HasPlayerFlag(), PvPInfo::IsHostile, IsPvP(), PLAYER_FLAGS_IN_PVP, pvpInfo, UpdateFFAPvPState(), and UpdatePvP().

Referenced by AddQuest(), Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), RewardQuest(), Unit::SetCharm(), and UpdateZone().

◆ UpdateRangedHitChances()

◆ UpdateRating()

void Player::UpdateRating ( CombatRating  cr)
611{
612 int32 amount = m_baseRatingValue[cr];
613 // Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
614 // stat used stored in miscValueB for this aura
615 AuraEffectList const& modRatingFromStat =
617 for (AuraEffectList::const_iterator i = modRatingFromStat.begin();
618 i != modRatingFromStat.end(); ++i)
619 if ((*i)->GetMiscValue() & (1 << cr))
620 amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())),
621 (*i)->GetAmount()));
622 if (amount < 0)
623 amount = 0;
624 SetUInt32Value(static_cast<uint16>(PLAYER_FIELD_COMBAT_RATING_1) + static_cast<uint16>(cr), uint32(amount));
625
626 bool affectStats = CanModifyStats();
627
628 switch (cr)
629 {
630 case CR_WEAPON_SKILL: // Implemented in Unit::RollMeleeOutcomeAgainst
631 case CR_DEFENSE_SKILL:
633 break;
634 case CR_DODGE:
636 break;
637 case CR_PARRY:
639 break;
640 case CR_BLOCK:
642 break;
643 case CR_HIT_MELEE:
645 break;
646 case CR_HIT_RANGED:
648 break;
649 case CR_HIT_SPELL:
651 break;
652 case CR_CRIT_MELEE:
653 if (affectStats)
654 {
657 }
658 break;
659 case CR_CRIT_RANGED:
660 if (affectStats)
662 break;
663 case CR_CRIT_SPELL:
664 if (affectStats)
666 break;
667 case CR_HIT_TAKEN_MELEE: // Implemented in Unit::MeleeMissChanceCalc
669 break;
670 case CR_HIT_TAKEN_SPELL: // Implemented in Unit::MagicSpellHitResult
671 break;
672 case CR_CRIT_TAKEN_MELEE: // Implemented in Unit::RollMeleeOutcomeAgainst
673 // (only for chance to crit)
675 break;
676 case CR_CRIT_TAKEN_SPELL: // Implemented in Unit::SpellCriticalBonus (only
677 // for chance to crit)
678 break;
679 case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod
680 case CR_HASTE_RANGED:
681 case CR_HASTE_SPELL:
682 break;
683 case CR_WEAPON_SKILL_MAINHAND: // Implemented in
684 // Unit::RollMeleeOutcomeAgainst
687 break;
688 case CR_EXPERTISE:
689 if (affectStats)
690 {
693 }
694 break;
696 if (affectStats)
698 break;
699 }
700}
@ SPELL_AURA_MOD_RATING_FROM_STAT
Definition SpellAuraDefines.h:283
@ CR_WEAPON_SKILL_RANGED
Definition Unit.h:240
@ CR_WEAPON_SKILL
Definition Unit.h:218
@ CR_WEAPON_SKILL_OFFHAND
Definition Unit.h:239
@ CR_WEAPON_SKILL_MAINHAND
Definition Unit.h:238
void UpdateArmorPenetration(int32 amount)
Definition StatSystem.cpp:864
void UpdateSpellHitChances()
Definition StatSystem.cpp:882
void UpdateMeleeHitChances()
Definition StatSystem.cpp:870
void UpdateRangedHitChances()
Definition StatSystem.cpp:876

References BASE_ATTACK, CalculatePct(), Unit::CanModifyStats(), CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_HIT_TAKEN_MELEE, CR_HIT_TAKEN_RANGED, CR_HIT_TAKEN_SPELL, CR_PARRY, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, Unit::GetAuraEffectsByType(), Unit::GetStat(), m_baseRatingValue, OFF_ATTACK, PLAYER_FIELD_COMBAT_RATING_1, RANGED_ATTACK, Unit::SetUInt32Value(), SPELL_AURA_MOD_RATING_FROM_STAT, UpdateAllSpellCritChances(), UpdateArmorPenetration(), UpdateBlockPercentage(), UpdateCritPercentage(), UpdateDefenseBonusesMod(), UpdateDodgePercentage(), UpdateExpertise(), UpdateMeleeHitChances(), UpdateParryPercentage(), UpdateRangedHitChances(), and UpdateSpellHitChances().

Referenced by ApplyRatingMod(), and UpdateAllRatings().

◆ UpdateResistances()

void Player::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

243{
244 if (school > SPELL_SCHOOL_NORMAL)
245 {
246 // cant use GetTotalAuraModValue because of total pct multiplier :P
247 float value = 0.0f;
248 UnitMods unitMod = UnitMods(UNIT_MOD_RESISTANCE_START + school);
249
250 value = GetModifierValue(unitMod, BASE_VALUE);
251 value *= GetModifierValue(unitMod, BASE_PCT);
252 value += GetModifierValue(unitMod, TOTAL_VALUE);
253
255 for(AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
256 {
257 if ((*i)->GetMiscValue() & (1 << (school - 1)))
258 value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
259 }
260
261 value *= GetModifierValue(unitMod, TOTAL_PCT);
262
263 SetResistance(SpellSchools(school), int32(value));
264 }
265 else
266 UpdateArmor();
267}

References BASE_PCT, BASE_VALUE, Unit::GetAuraEffectsByType(), Unit::GetModifierValue(), Unit::GetStat(), Unit::SetResistance(), SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT, SPELL_SCHOOL_NORMAL, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_RESISTANCE_START, and UpdateArmor().

◆ UpdateRuneRegen()

void Player::UpdateRuneRegen ( RuneType  rune)
988{
989 if (rune >= NUM_RUNE_TYPES)
990 return;
991
992 uint32 cooldown = 0;
993
994 for (uint32 i = 0; i < MAX_RUNES; ++i)
995 if (GetBaseRune(i) == rune)
996 {
997 cooldown = GetRuneBaseCooldown(i, true);
998 break;
999 }
1000
1001 if (cooldown <= 0)
1002 return;
1003
1004 float regen = float(1 * IN_MILLISECONDS) / float(cooldown);
1005 SetFloatValue(PLAYER_RUNE_REGEN_1 + uint8(rune), regen);
1006}
uint32 GetRuneBaseCooldown(uint8 index, bool skipGrace)
Definition Player.cpp:13335

References GetBaseRune(), GetRuneBaseCooldown(), IN_MILLISECONDS, MAX_RUNES, NUM_RUNE_TYPES, PLAYER_RUNE_REGEN_1, and Object::SetFloatValue().

Referenced by AuraEffect::HandleModPowerRegen().

◆ UpdateShieldBlockValue()

void Player::UpdateShieldBlockValue ( )
540{
542}
uint32 GetShieldBlockValue() const override
Definition Player.cpp:5119

References GetShieldBlockValue(), PLAYER_SHIELD_BLOCK, and Unit::SetUInt32Value().

Referenced by HandleBaseModValue(), UpdateAllStats(), and UpdateStats().

◆ UpdateSkill()

bool Player::UpdateSkill ( uint32  skill_id,
uint32  step 
)
710{
711 if (!skill_id || !sScriptMgr->OnPlayerCanUpdateSkill(this, skill_id))
712 return false;
713
714 SkillStatusMap::iterator itr = mSkillStatus.find(skill_id);
715 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
716 return false;
717
718 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
719 uint32 data = GetUInt32Value(valueIndex);
720 uint32 value = SKILL_VALUE(data);
721 uint32 max = SKILL_MAX(data);
722
723 sScriptMgr->OnPlayerBeforeUpdateSkill(this, skill_id, value, max, step);
724
725 if ((!max) || (!value) || (value >= max))
726 return false;
727
728 if (value < max)
729 {
730 uint32 new_value = value + step;
731 if (new_value > max)
732 new_value = max;
733
734 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, max));
735 if (itr->second.uState != SKILL_NEW)
736 itr->second.uState = SKILL_CHANGED;
737
738 UpdateSkillEnchantments(skill_id, value, new_value);
740 skill_id);
741
742 sScriptMgr->OnPlayerUpdateSkill(this, skill_id, value, max, step, new_value);
743 return true;
744 }
745
746 return false;
747}

References ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, Object::GetUInt32Value(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Unit::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_VALUE, sScriptMgr, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by UpdateDefense(), and UpdateWeaponSkill().

◆ UpdateSkillEnchantments()

void Player::UpdateSkillEnchantments ( uint16  skill_id,
uint16  curr_value,
uint16  new_value 
)
4689{
4690 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
4691 {
4692 if (m_items[i])
4693 {
4694 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
4695 {
4696 uint32 ench_id = m_items[i]->GetEnchantmentId(EnchantmentSlot(slot));
4697 if (!ench_id)
4698 continue;
4699
4700 SpellItemEnchantmentEntry const* Enchant = sSpellItemEnchantmentStore.LookupEntry(ench_id);
4701 if (!Enchant)
4702 return;
4703
4704 if (Enchant->requiredSkill == skill_id)
4705 {
4706 // Checks if the enchantment needs to be applied or removed
4707 if (curr_value < Enchant->requiredSkillValue && new_value >= Enchant->requiredSkillValue)
4708 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
4709 else if (new_value < Enchant->requiredSkillValue && curr_value >= Enchant->requiredSkillValue)
4710 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
4711 }
4712
4713 // If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
4714 // rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
4716 && !m_items[i]->GetTemplate()->Socket[slot - SOCK_ENCHANTMENT_SLOT].Color)
4717 {
4718 SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
4719
4720 if (pPrismaticEnchant && pPrismaticEnchant->requiredSkill == skill_id)
4721 {
4722 if (curr_value < pPrismaticEnchant->requiredSkillValue && new_value >= pPrismaticEnchant->requiredSkillValue)
4723 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
4724 else if (new_value < pPrismaticEnchant->requiredSkillValue && curr_value >= pPrismaticEnchant->requiredSkillValue)
4725 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
4726 }
4727 }
4728 }
4729 }
4730 }
4731}
Definition Socket.h:52

References ApplyEnchantment(), Item::GetEnchantmentId(), INVENTORY_SLOT_BAG_END, m_items, MAX_ENCHANTMENT_SLOT, PRISMATIC_ENCHANTMENT_SLOT, SpellItemEnchantmentEntry::requiredSkill, SpellItemEnchantmentEntry::requiredSkillValue, SOCK_ENCHANTMENT_SLOT, SOCK_ENCHANTMENT_SLOT_2, SOCK_ENCHANTMENT_SLOT_3, and sSpellItemEnchantmentStore.

Referenced by SetSkill(), UpdateSkill(), and UpdateSkillPro().

◆ UpdateSkillPro()

bool Player::UpdateSkillPro ( uint16  SkillId,
int32  Chance,
uint32  step 
)
914{
915 LOG_DEBUG("entities.player.skills",
916 "UpdateSkillPro(SkillId {}, Chance {:3.1f}%)", SkillId,
917 Chance / 10.0f);
918 if (!SkillId || !sScriptMgr->OnPlayerCanUpdateSkill(this, SkillId))
919 return false;
920
921 if (Chance <= 0) // speedup in 0 chance case
922 {
923 LOG_DEBUG("entities.player.skills",
924 "Player::UpdateSkillPro Chance={:3.1f}% missed",
925 Chance / 10.0f);
926 return false;
927 }
928
929 SkillStatusMap::iterator itr = mSkillStatus.find(SkillId);
930 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
931 return false;
932
933 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
934
935 uint32 data = GetUInt32Value(valueIndex);
936 uint32 SkillValue = SKILL_VALUE(data);
937 uint32 MaxValue = SKILL_MAX(data);
938
939 sScriptMgr->OnPlayerBeforeUpdateSkill(this, SkillId, SkillValue, MaxValue, step);
940
941 if (!MaxValue || !SkillValue || SkillValue >= MaxValue)
942 return false;
943
944 int32 Roll = irand(1, 1000);
945
946 if (Roll <= Chance)
947 {
948 uint32 new_value = SkillValue + step;
949 if (new_value > MaxValue)
950 new_value = MaxValue;
951
952 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, MaxValue));
953 if (itr->second.uState != SKILL_NEW)
954 itr->second.uState = SKILL_CHANGED;
955
956 for (std::size_t i = 0; i < bonusSkillLevelsSize; ++i)
957 {
958 uint32 bsl = bonusSkillLevels[i];
959 if (SkillValue < bsl && new_value >= bsl)
960 {
961 learnSkillRewardedSpells(SkillId, new_value);
962 break;
963 }
964 }
965 UpdateSkillEnchantments(SkillId, SkillValue, new_value);
967 SkillId);
968 LOG_DEBUG("entities.player.skills",
969 "Player::UpdateSkillPro Chance={:3.1f}% taken",
970 Chance / 10.0f);
971
972 sScriptMgr->OnPlayerUpdateSkill(this, SkillId, SkillValue, MaxValue, step, new_value);
973 return true;
974 }
975
976 LOG_DEBUG("entities.player.skills",
977 "Player::UpdateSkillPro Chance={:3.1f}% missed", Chance / 10.0f);
978 return false;
979}
static uint32 bonusSkillLevels[]
Definition PlayerUpdates.cpp:909
static const std::size_t bonusSkillLevelsSize
Definition PlayerUpdates.cpp:910
int32 irand(int32 min, int32 max)
Definition Random.cpp:37
Definition Group.h:143

References ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, bonusSkillLevels, bonusSkillLevelsSize, Object::GetUInt32Value(), irand(), learnSkillRewardedSpells(), LOG_DEBUG, MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Unit::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_VALUE, sScriptMgr, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by UpdateCraftSkill(), UpdateFishingSkill(), and UpdateGatherSkill().

◆ UpdateSkillsForLevel()

void Player::UpdateSkillsForLevel ( )

update only level dependent max skill values

maximize skill always

update max skill value if current max skill not maximized

1080{
1081 uint16 maxconfskill = sWorld->GetConfigMaxSkillValue();
1082 uint32 maxSkill = GetMaxSkillValueForLevel();
1083
1084 bool alwaysMaxSkill =
1086
1087 for (SkillStatusMap::iterator itr = mSkillStatus.begin();
1088 itr != mSkillStatus.end(); ++itr)
1089 {
1090 if (itr->second.uState == SKILL_DELETED)
1091 continue;
1092
1093 uint32 pskill = itr->first;
1094 SkillRaceClassInfoEntry const* rcEntry =
1096 if (!rcEntry)
1097 continue;
1098
1099 if (GetSkillRangeType(rcEntry) != SKILL_RANGE_LEVEL)
1100 continue;
1101
1102 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
1103 uint32 data = GetUInt32Value(valueIndex);
1104 uint32 max = SKILL_MAX(data);
1105 uint32 val = SKILL_VALUE(data);
1106
1108 if (max != 1)
1109 {
1111 if (alwaysMaxSkill ||
1113 {
1114 SetUInt32Value(valueIndex,
1115 MAKE_SKILL_VALUE(maxSkill, maxSkill));
1116 if (itr->second.uState != SKILL_NEW)
1117 itr->second.uState = SKILL_CHANGED;
1118 }
1119 else if (max != maxconfskill)
1121 {
1122 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(val, maxSkill));
1123 if (itr->second.uState != SKILL_NEW)
1124 itr->second.uState = SKILL_CHANGED;
1125 }
1126 }
1127 }
1128}
@ CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL
Definition WorldConfig.h:54

References CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL, SkillRaceClassInfoEntry::Flags, Unit::getClass(), GetMaxSkillValueForLevel(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), Object::GetUInt32Value(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Unit::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_FLAG_ALWAYS_MAX_VALUE, SKILL_MAX, SKILL_NEW, SKILL_RANGE_LEVEL, SKILL_VALUE, and sWorld.

Referenced by GiveLevel(), InitStatsForLevel(), and LoadFromDB().

◆ UpdateSkillsToMaxSkillsForLevel()

void Player::UpdateSkillsToMaxSkillsForLevel ( )
1131{
1132 for (SkillStatusMap::iterator itr = mSkillStatus.begin();
1133 itr != mSkillStatus.end(); ++itr)
1134 {
1135 if (itr->second.uState == SKILL_DELETED)
1136 continue;
1137
1138 uint32 pskill = itr->first;
1139 if (IsProfessionOrRidingSkill(pskill))
1140 continue;
1141 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
1142 uint32 data = GetUInt32Value(valueIndex);
1143 uint32 max = SKILL_MAX(data);
1144
1145 if (max > 1)
1146 {
1147 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(max, max));
1148 if (itr->second.uState != SKILL_NEW)
1149 itr->second.uState = SKILL_CHANGED;
1150 }
1151 if (pskill == SKILL_DEFENSE)
1153 }
1154}

References Object::GetUInt32Value(), IsProfessionOrRidingSkill(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Unit::SetUInt32Value(), SKILL_CHANGED, SKILL_DEFENSE, SKILL_DELETED, SKILL_MAX, SKILL_NEW, and UpdateDefenseBonusesMod().

Referenced by GiveLevel(), and misc_commandscript::HandleMaxSkillCommand().

◆ UpdateSoulboundTradeItems()

void Player::UpdateSoulboundTradeItems ( )
4109{
4110 std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
4111 if (m_itemSoulboundTradeable.empty())
4112 return;
4113
4114 // also checks for garbage data
4115 for (ItemDurationList::iterator itr = m_itemSoulboundTradeable.begin(); itr != m_itemSoulboundTradeable.end();)
4116 {
4117 ASSERT(*itr);
4118 if ((*itr)->GetOwnerGUID() != GetGUID())
4119 {
4120 m_itemSoulboundTradeable.erase(itr++);
4121 continue;
4122 }
4123 if ((*itr)->CheckSoulboundTradeExpire())
4124 {
4125 m_itemSoulboundTradeable.erase(itr++);
4126 continue;
4127 }
4128 ++itr;
4129 }
4130}

References ASSERT, Object::GetGUID(), m_itemSoulboundTradeable, and m_soulboundTradableLock.

Referenced by Update().

◆ UpdateSpeakTime()

void Player::UpdateSpeakTime ( ChatFloodThrottle::Index  index)
30{
31 // ignore chat spam protection for GMs in any mode
33 return;
34
35 uint32 limit, delay;
36 switch (index)
37 {
39 limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT);
40 delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY);
41 break;
43 limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
44 delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_DELAY);
45 [[fallthrough]];
46 default:
47 return;
48 }
49 time_t current = GameTime::GetGameTime().count();
50 if (m_chatFloodData[index].Time > current)
51 {
52 ++m_chatFloodData[index].Count;
53 if (m_chatFloodData[index].Count >= limit)
54 {
55 // prevent overwrite mute time, if message send just before mutes set, for example.
56 time_t new_mute = current + sWorld->getIntConfig(CONFIG_CHATFLOOD_MUTE_TIME);
57 if (GetSession()->m_muteTime < new_mute)
58 GetSession()->m_muteTime = new_mute;
59
60 m_chatFloodData[index].Count = 0;
61 }
62 }
63 else
64 m_chatFloodData[index].Count = 1;
65
66 m_chatFloodData[index].Time = current + delay;
67}
@ CONFIG_CHATFLOOD_MUTE_TIME
Definition WorldConfig.h:230
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT
Definition WorldConfig.h:228
@ CONFIG_CHATFLOOD_MESSAGE_DELAY
Definition WorldConfig.h:227
@ CONFIG_CHATFLOOD_MESSAGE_COUNT
Definition WorldConfig.h:226
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY
Definition WorldConfig.h:229
std::array< ChatFloodThrottle, ChatFloodThrottle::MAX > m_chatFloodData
Definition Player.h:2799
@ ADDON
Definition Player.h:2336
@ REGULAR
Definition Player.h:2335

References Player::ChatFloodThrottle::ADDON, CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT, CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY, CONFIG_CHATFLOOD_MESSAGE_COUNT, CONFIG_CHATFLOOD_MESSAGE_DELAY, CONFIG_CHATFLOOD_MUTE_TIME, GameTime::GetGameTime(), GetSession(), AccountMgr::IsPlayerAccount(), m_chatFloodData, WorldSession::m_muteTime, Player::ChatFloodThrottle::REGULAR, and sWorld.

Referenced by WorldSession::HandleMessagechatOpcode(), and WorldSession::HandleTextEmoteOpcode().

◆ UpdateSpecCount()

void Player::UpdateSpecCount ( uint8  count)
2197{
2198 uint32 curCount = GetSpecsCount();
2199 if (curCount == count)
2200 return;
2201
2202 if (m_activeSpec >= count)
2203 ActivateSpec(0);
2204
2205 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2206 CharacterDatabasePreparedStatement* stmt = nullptr;
2207
2208 // Copy spec data
2209 if (count > curCount)
2210 {
2211 _SaveActions(trans); // make sure the button list is cleaned up
2212 for (ActionButtonList::iterator itr = m_actionButtons.begin();
2213 itr != m_actionButtons.end(); ++itr)
2214 {
2215 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
2216 stmt->SetData(0, GetGUID().GetCounter());
2217 stmt->SetData(1, 1);
2218 stmt->SetData(2, itr->first);
2219 stmt->SetData(3, itr->second.GetAction());
2220 stmt->SetData(4, uint8(itr->second.GetType()));
2221 trans->Append(stmt);
2222 }
2223 }
2224 // Delete spec data for removed spec.
2225 else if (count < curCount)
2226 {
2227 _SaveActions(trans);
2228
2229 stmt = CharacterDatabase.GetPreparedStatement(
2231 stmt->SetData(0, m_activeSpec);
2232 stmt->SetData(1, GetGUID().GetCounter());
2233 trans->Append(stmt);
2234
2235 m_activeSpec = 0;
2236 }
2237
2238 CharacterDatabase.CommitTransaction(trans);
2239
2240 SetSpecsCount(count);
2241
2242 SendTalentsInfoData(false);
2243}
@ CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC
Definition CharacterDatabase.h:459
void ActivateSpec(uint8 spec)
Definition Player.cpp:15037
void SetSpecsCount(uint8 count)
Definition Player.h:1758

References _SaveActions(), ActivateSpec(), CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, CHAR_INS_CHAR_ACTION, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), GetSpecsCount(), m_actionButtons, m_activeSpec, SendTalentsInfoData(), PreparedStatementBase::SetData(), and SetSpecsCount().

◆ UpdateSpellCritChance()

void Player::UpdateSpellCritChance ( uint32  school)
840{
841 // For normal school set zero crit chance
842 if (school == SPELL_SCHOOL_NORMAL)
843 {
845 return;
846 }
847 // For others recalculate it from:
848 float crit = 0.0f;
849 // Crit from Intellect
851 // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
853 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
855 // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
857 // Increase crit from spell crit ratings
859
860 // Store crit value
862}
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition SpellAuraDefines.h:134
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:120
@ SPELL_AURA_MOD_CRIT_PCT
Definition SpellAuraDefines.h:353
float GetSpellCritFromIntellect()
Definition Player.cpp:5198
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6048
int32 GetTotalAuraModifierAreaExclusive(AuraType auratype) const
Definition Unit.cpp:5977

References CR_CRIT_SPELL, GetRatingBonusValue(), GetSpellCritFromIntellect(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierAreaExclusive(), Unit::GetTotalAuraModifierByMiscMask(), PLAYER_SPELL_CRIT_PERCENTAGE1, Object::SetFloatValue(), SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by AuraEffect::HandleModSpellCritChanceShool(), and UpdateAllSpellCritChances().

◆ UpdateSpellDamageAndHealingBonus()

void Player::UpdateSpellDamageAndHealingBonus ( )
195{
196 // Magic damage modifiers implemented in Unit::SpellDamageBonusDone
197 // This information for client side use only
198 // Get healing bonus for all schools
200 // Get damage bonus for all schools
201 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
203}
void SetStatInt32Value(uint16 index, int32 value)
Definition Object.cpp:787
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:12786
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:12020

References MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, PLAYER_FIELD_MOD_HEALING_DONE_POS, Object::SetStatInt32Value(), SPELL_SCHOOL_HOLY, SPELL_SCHOOL_MASK_ALL, Unit::SpellBaseDamageBonusDone(), and Unit::SpellBaseHealingBonusDone().

Referenced by AuraEffect::HandleModHealingDone(), AuraEffect::HandleModSpellDamagePercentFromAttackPower(), AuraEffect::HandleModSpellDamagePercentFromStat(), AuraEffect::HandleModSpellHealingPercentFromAttackPower(), AuraEffect::HandleModSpellHealingPercentFromStat(), UpdateAllStats(), UpdateAttackPowerAndDamage(), and UpdateStats().

◆ UpdateSpellHitChances()

void Player::UpdateSpellHitChances ( )

◆ UpdateStats()

bool Player::UpdateStats ( Stats  stat)
overridevirtual

Implements Unit.

98{
99 if (stat > STAT_SPIRIT)
100 return false;
101
102 // value = ((base_value * base_pct) + total_value) * total_pct
103 float value = GetTotalStatValue(stat);
104
105 SetStat(stat, int32(value));
106
107 switch (stat)
108 {
109 case STAT_STRENGTH:
111 break;
112 case STAT_AGILITY:
113 UpdateArmor();
116 break;
117 case STAT_STAMINA:
119 break;
120 case STAT_INTELLECT:
123 UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
124 break;
125 default:
126 break;
127 }
128
129 if (stat == STAT_STRENGTH)
130 {
134 }
135 else if (stat == STAT_AGILITY)
136 {
139 }
140 else
141 {
142 // Need update (exist AP from stat auras)
147 }
148
151
152 // Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
153 uint32 mask = 0;
155 for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
156 if (Stats((*i)->GetMiscValueB()) == stat)
157 mask |= (*i)->GetMiscValue();
158 if (mask)
159 {
160 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
161 if (mask & (1 << rating))
162 ApplyRatingMod(CombatRating(rating), 0, true);
163 }
164 return true;
165}

References ApplyRatingMod(), Unit::GetAuraEffectsByType(), Unit::GetTotalStatValue(), Unit::HasAuraTypeWithMiscvalue(), MAX_COMBAT_RATING, POWER_MANA, Unit::SetStat(), SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RATING_FROM_STAT, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UpdateAllCritPercentages(), UpdateAllSpellCritChances(), UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDodgePercentage(), UpdateManaRegen(), UpdateMaxHealth(), UpdateMaxPower(), UpdateShieldBlockValue(), and UpdateSpellDamageAndHealingBonus().

◆ UpdateTitansGrip()

void Player::UpdateTitansGrip ( )

◆ UpdateTriggerVisibility()

void Player::UpdateTriggerVisibility ( )
1749{
1750 if (!IsInWorld())
1751 return;
1752
1753 if (GetObjectVisibilityContainer().GetVisibleWorldObjectsMap()->empty())
1754 return;
1755
1756 UpdateData udata;
1757 DoForAllVisibleWorldObjects([this, &udata](WorldObject* worldObject)
1758 {
1759 if (worldObject->IsCreature())
1760 {
1761 Creature* creature = worldObject->ToCreature();
1762 // Update fields of triggers, transformed units or unselectable
1763 // units (values dependent on GM state)
1764 if (!creature || (!creature->IsTrigger() &&
1765 !creature->HasTransformAura() &&
1766 !creature->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE)))
1767 return;
1768
1769 creature->SetFieldNotifyFlag(UF_FLAG_PUBLIC);
1770 creature->BuildValuesUpdateBlockForPlayer(&udata, this);
1771 creature->RemoveFieldNotifyFlag(UF_FLAG_PUBLIC);
1772 }
1773 else if (worldObject->IsGameObject())
1774 {
1775 GameObject* go = worldObject->ToGameObject();
1776 if (!go)
1777 return;
1778
1779 go->SetFieldNotifyFlag(UF_FLAG_PUBLIC);
1780 go->BuildValuesUpdateBlockForPlayer(&udata, this);
1781 go->RemoveFieldNotifyFlag(UF_FLAG_PUBLIC);
1782 }
1783 });
1784
1785 if (!udata.HasData())
1786 return;
1787
1788 WorldPacket packet;
1789 udata.BuildPacket(packet);
1790 GetSession()->SendPacket(&packet);
1791}

References UpdateData::BuildPacket(), WorldObject::DoForAllVisibleWorldObjects(), WorldObject::GetObjectVisibilityContainer(), GetSession(), UpdateData::HasData(), Object::IsCreature(), Object::IsGameObject(), Object::IsInWorld(), and WorldSession::SendPacket().

Referenced by gm_commandscript::HandleGMOffCommand(), and gm_commandscript::HandleGMOnCommand().

◆ UpdateVisibilityForPlayer()

void Player::UpdateVisibilityForPlayer ( bool  mapChange = false)
1593{
1594 // After added to map seer must be a player - there is no possibility to
1595 // still have different seer (all charm auras must be already removed)
1596 if (mapChange && m_seer != this)
1597 {
1598 m_seer = this;
1599 }
1600
1601 Acore::VisibleNotifier notifierNoLarge(
1602 *this, mapChange,
1603 false); // visit only objects which are not large; default distance
1604 Cell::VisitObjects(m_seer, notifierNoLarge,
1606 notifierNoLarge.SendToSelf();
1607
1608 Acore::VisibleNotifier notifierLarge(
1609 *this, mapChange, true); // visit only large objects; maximum distance
1610 Cell::VisitObjects(m_seer, notifierLarge, GetSightRange());
1611 notifierLarge.SendToSelf();
1612
1613 if (mapChange)
1614 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
1615}
#define VISIBILITY_INC_FOR_GOBJECTS
Definition ObjectDefines.h:28
float GetSightRange(WorldObject const *target=nullptr) const override
Definition Player.cpp:16252
Position m_last_notify_position
Definition Unit.h:2022
Definition GridNotifiers.h:44

References GetSightRange(), Unit::m_last_notify_position, m_seer, Position::Relocate(), Acore::VisibleNotifier::SendToSelf(), VISIBILITY_INC_FOR_GOBJECTS, and Cell::VisitObjects().

Referenced by WorldSession::HandleFarSightOpcode(), SendInitialPacketsAfterAddToMap(), and UpdateObjectVisibility().

◆ UpdateVisibilityOf() [1/2]

template<class T >
void Player::UpdateVisibilityOf ( T *  target,
UpdateData data,
std::vector< Unit * > &  visibleNow 
)
1685{
1687
1688 if (HaveAtClient(target))
1689 {
1690 if (!CanSeeOrDetect(target, false, true))
1691 {
1692 BeforeVisibilityDestroy<T>(target, this);
1693
1694 target->BuildOutOfRangeUpdateBlock(&data);
1696 }
1697 }
1698 else
1699 {
1700 if (CanSeeOrDetect(target, false, true))
1701 {
1702 target->BuildCreateUpdateBlockForPlayer(&data, this);
1703 UpdateVisibilityOf_helper(this, target, visibleNow);
1704 }
1705 }
1706}
void UpdateVisibilityOf_helper(Player *player, T *target, std::vector< Unit * > &)
Definition PlayerUpdates.cpp:1638
void AddObjectToPendingUpdateList(WorldObject *obj)
Definition Map.cpp:555
void UnlinkWorldObjectVisibility(WorldObject *worldObject)
Definition ObjectVisibilityContainer.cpp:77
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition Object.cpp:1694

References Map::AddObjectToPendingUpdateList(), WorldObject::CanSeeOrDetect(), WorldObject::GetMap(), WorldObject::GetObjectVisibilityContainer(), HaveAtClient(), ObjectVisibilityContainer::UnlinkWorldObjectVisibility(), and UpdateVisibilityOf_helper().

◆ UpdateVisibilityOf() [2/2]

void Player::UpdateVisibilityOf ( WorldObject target)
1720{
1721 if (HaveAtClient(target))
1722 {
1723 if (!CanSeeOrDetect(target, false, true))
1724 {
1725 if (target->IsCreature())
1727
1728 target->DestroyForPlayer(this);
1730 }
1731 }
1732 else
1733 {
1734 if (CanSeeOrDetect(target, false, true))
1735 {
1736 target->SendUpdateToPlayer(this);
1738
1739 // target aura duration for caster show only if target exist at
1740 // caster client send data at target visibility change (adding to
1741 // client)
1742 if (target->IsUnit())
1743 GetInitialVisiblePackets((Unit*) target);
1744 }
1745 }
1746}
void BeforeVisibilityDestroy< Creature >(Creature *t, Player *p)
Definition PlayerUpdates.cpp:1676
void LinkWorldObjectVisibility(WorldObject *worldObject)
Definition ObjectVisibilityContainer.cpp:63
void GetInitialVisiblePackets(Unit *target)
Definition PlayerUpdates.cpp:1708

References BeforeVisibilityDestroy< Creature >(), WorldObject::CanSeeOrDetect(), Object::DestroyForPlayer(), GetInitialVisiblePackets(), WorldObject::GetObjectVisibilityContainer(), HaveAtClient(), Object::IsCreature(), Object::IsUnit(), ObjectVisibilityContainer::LinkWorldObjectVisibility(), Object::SendUpdateToPlayer(), Object::ToCreature(), and ObjectVisibilityContainer::UnlinkWorldObjectVisibility().

Referenced by instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), Acore::VisibleNotifier::SendToSelf(), SetViewpoint(), Acore::VisibleNotifier::Visit(), Acore::VisibleNotifier::Visit(), Acore::PlayerRelocationNotifier::Visit(), and Acore::CreatureRelocationNotifier::Visit().

◆ UpdateWeaponSkill()

void Player::UpdateWeaponSkill ( Unit victim,
WeaponAttackType  attType,
Item item = nullptr 
)
982{
983 if (IsInFeralForm())
984 return; // always maximized SKILL_FERAL_COMBAT in fact
985
987 return; // use weapon but not skill up
988
990 return;
991
992 uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
993
994 Item* tmpitem = GetWeaponForAttack(attType, true);
995 if (item && item != tmpitem && !item->IsBroken())
996 {
997 tmpitem = item;
998 }
999
1000 if (!tmpitem && attType == BASE_ATTACK)
1001 {
1002 // Keep unarmed & fist weapon skills in sync
1003 UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
1004 UpdateSkill(SKILL_FIST_WEAPONS, weapon_skill_gain);
1005 }
1006 else if (tmpitem && tmpitem->GetTemplate()->SubClass !=
1008 {
1009 switch (tmpitem->GetTemplate()->SubClass)
1010 {
1012 break;
1014 UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
1015 [[fallthrough]];
1016 default:
1017 UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
1018 break;
1019 }
1020 }
1021
1023}
@ CREATURE_FLAG_EXTRA_NO_SKILL_GAINS
Definition CreatureData.h:63
@ ITEM_SUBCLASS_WEAPON_FIST
Definition ItemTemplate.h:357
@ FORM_TREE
Definition UnitDefines.h:71
@ CONFIG_SKILL_GAIN_WEAPON
Definition WorldConfig.h:223

References BASE_ATTACK, CONFIG_SKILL_GAIN_WEAPON, CREATURE_FLAG_EXTRA_NO_SKILL_GAINS, FORM_TREE, Unit::GetShapeshiftForm(), Item::GetSkill(), Item::GetTemplate(), GetWeaponForAttack(), Creature::HasFlagsExtra(), Item::IsBroken(), Object::IsCreature(), Unit::IsInFeralForm(), ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_FIST, SKILL_FIST_WEAPONS, SKILL_UNARMED, ItemTemplate::SubClass, sWorld, Object::ToCreature(), UpdateAllCritPercentages(), and UpdateSkill().

Referenced by UpdateCombatSkills().

◆ UpdateZone()

void Player::UpdateZone ( uint32  newZone,
uint32  newArea,
bool  force = false 
)
1253{
1254 if (!newZone)
1255 return;
1256
1257 if (m_zoneUpdateId != newZone || force)
1258 {
1259 sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1260 sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
1261 sWorldState->HandlePlayerLeaveZone(this, static_cast<AreaTableIDs>(m_zoneUpdateId));
1262 sWorldState->HandlePlayerEnterZone(this, static_cast<AreaTableIDs>(newZone));
1263 }
1264 if (m_zoneUpdateId != newZone)
1265 {
1266 sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1267 sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
1268 SendInitWorldStates(newZone,
1269 newArea); // only if really enters to new zone, not
1270 // just area change, works strange...
1271 if (Guild* guild = GetGuild())
1272 guild->UpdateMemberData(this, GUILD_MEMBER_DATA_ZONEID, newZone);
1273 }
1274
1276
1277 // group update
1278 if (GetGroup())
1280
1281 m_zoneUpdateId = newZone;
1283
1284 // zone changed, so area changed as well, update it
1285 UpdateArea(newArea);
1286
1287 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(newZone);
1288 if (!zone)
1289 return;
1290
1291 if (sWorld->getBoolConfig(CONFIG_WEATHER))
1292 {
1293 if (Weather* weather = WeatherMgr::FindWeather(zone->ID))
1294 weather->SendWeatherUpdateToPlayer(this);
1295 else if (!WeatherMgr::AddWeather(zone->ID))
1296 // send fine weather packet to remove old zone's weather
1298 }
1299
1300 sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);
1301
1302 // in PvP, any not controlled zone (except zone->team == 6, default case)
1303 // in PvE, only opposition team capital
1304 switch (zone->team)
1305 {
1306 case AREATEAM_ALLY:
1308 GetTeamId(true) != TEAM_ALLIANCE &&
1309 (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
1310 break;
1311 case AREATEAM_HORDE:
1313 GetTeamId(true) != TEAM_HORDE &&
1314 (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
1315 break;
1316 case AREATEAM_NONE:
1317 // overwrite for battlegrounds, maybe batter some zone flags but current
1318 // known not 100% fit to this
1319 pvpInfo.IsInHostileArea = sWorld->IsPvPRealm() || InBattleground() ||
1321 break;
1322 default: // 6 in fact
1323 pvpInfo.IsInHostileArea = false;
1324 break;
1325 }
1326
1327 // Treat players having a quest flagging for PvP as always in hostile area
1329
1330 if (zone->flags & AREA_FLAG_CAPITAL) // Is in a capital city
1331 {
1332 if (!pvpInfo.IsHostile || zone->IsSanctuary())
1334
1335 pvpInfo.IsInNoPvPArea = true;
1336 }
1337 else
1338 RemoveRestFlag(REST_FLAG_IN_CITY); // Recently left a capital city
1339
1341
1342 // remove items with area/map limitations (delete only for alive player to
1343 // allow back in ghost mode) if player resurrected at teleport this will be
1344 // applied in resurrect code
1345 if (IsAlive())
1346 DestroyZoneLimitedItem(true, newZone);
1347
1348 // check some item equip limitations (in result lost CanTitanGrip at talent
1349 // reset, for example)
1351
1352 // recent client version not send leave/join channel packets for built-in
1353 // local channels
1354 UpdateLocalChannels(newZone);
1355
1356 UpdateZoneDependentAuras(newZone);
1357}
@ AREATEAM_HORDE
Definition DBCEnums.h:58
@ AREATEAM_NONE
Definition DBCEnums.h:56
@ AREATEAM_ALLY
Definition DBCEnums.h:57
@ AREA_FLAG_CAPITAL
Definition DBCEnums.h:242
@ AREA_FLAG_WINTERGRASP
Definition DBCEnums.h:258
@ GROUP_UPDATE_FULL
Definition Group.h:121
@ GUILD_MEMBER_DATA_ZONEID
Definition Guild.h:58
@ REST_FLAG_IN_CITY
Definition Player.h:822
@ CONFIG_WEATHER
Definition WorldConfig.h:53
void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
Definition Map.cpp:408
void UpdateLocalChannels(uint32 newZone)
Definition PlayerUpdates.cpp:502
void SendInitWorldStates(uint32 zoneId, uint32 areaId)
Definition Player.cpp:8205
void DestroyZoneLimitedItem(bool update, uint32 new_zone)
Definition PlayerStorage.cpp:3312
Weather for one zone.
Definition Weather.h:64
Weather * AddWeather(uint32 zone_id)
Add a Weather object to the list.
Definition WeatherMgr.cpp:66
void SendFineWeatherUpdateToPlayer(Player *player)
Definition WeatherMgr.cpp:144
Weather * FindWeather(uint32 id)
Find a Weather object by the given zoneid.
Definition WeatherMgr.cpp:49
uint32 ID
Definition DBCStructure.h:520
uint32 team
Definition DBCStructure.h:529

References WeatherMgr::AddWeather(), AREA_FLAG_CAPITAL, AREA_FLAG_WINTERGRASP, AREATEAM_ALLY, AREATEAM_HORDE, AREATEAM_NONE, AutoUnequipOffhandIfNeed(), CONFIG_WEATHER, DestroyZoneLimitedItem(), WeatherMgr::FindWeather(), AreaTableEntry::flags, GetGroup(), GetGuild(), WorldObject::GetMap(), GetTeamId(), GROUP_UPDATE_FULL, GUILD_MEMBER_DATA_ZONEID, HasPvPForcingQuest(), AreaTableEntry::ID, InBattleground(), Unit::IsAlive(), PvPInfo::IsHostile, PvPInfo::IsInHostileArea, PvPInfo::IsInNoPvPArea, AreaTableEntry::IsSanctuary(), m_zoneUpdateId, m_zoneUpdateTimer, pvpInfo, RemoveRestFlag(), REST_FLAG_IN_CITY, sAreaTableStore, sBattlefieldMgr, WeatherMgr::SendFineWeatherUpdateToPlayer(), SendInitWorldStates(), SetGroupUpdateFlag(), SetRestFlag(), sOutdoorPvPMgr, sScriptMgr, sWorld, sWorldState, AreaTableEntry::team, TEAM_ALLIANCE, TEAM_HORDE, UpdateArea(), UpdateLocalChannels(), Map::UpdatePlayerZoneStats(), UpdatePvPState(), UpdateZoneDependentAuras(), and ZONE_UPDATE_INTERVAL.

Referenced by WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), Map::RemovePlayerFromMap(), ResurrectPlayer(), SendInitialPacketsAfterAddToMap(), Update(), and UpdatePosition().

◆ UpdateZoneDependentAuras()

void Player::UpdateZoneDependentAuras ( uint32  zone_id)
1856{
1857 // Some spells applied at enter into zone (with subzones), aura removed in
1858 // UpdateAreaDependentAuras that called always at zone->area update
1859 SpellAreaForAreaMapBounds saBounds =
1860 sSpellMgr->GetSpellAreaForAreaMapBounds(newZone);
1861 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first;
1862 itr != saBounds.second; ++itr)
1863 if (itr->second->autocast &&
1864 itr->second->IsFitToRequirements(this, newZone, 0))
1865 if (!HasAura(itr->second->spellId))
1866 CastSpell(this, itr->second->spellId, true);
1867}

References Unit::CastSpell(), Unit::HasAura(), and sSpellMgr.

Referenced by AddQuest(), CompleteQuest(), WorldSession::HandlePlayerLoginFromDB(), IncompleteQuest(), RemoveActiveQuest(), RewardQuest(), and UpdateZone().

◆ VehicleSpellInitialize()

void Player::VehicleSpellInitialize ( )
9612{
9613 Creature* vehicle = GetVehicleCreatureBase();
9614 if (!vehicle)
9615 return;
9616
9617 uint8 cooldownCount = vehicle->m_CreatureSpellCooldowns.size();
9618
9619 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4));
9620 data << vehicle->GetGUID(); // Guid
9621 data << uint16(0); // Pet Family (0 for all vehicles)
9622 data << uint32(vehicle->IsSummon() ? vehicle->ToTempSummon()->GetTimer() : 0); // Duration
9623 // The following three segments are read by the client as one uint32
9624 data << uint8(vehicle->GetReactState()); // React State
9625 data << uint8(0); // Command State
9626 data << uint16(0x800); // DisableActions (set for all vehicles)
9627
9628 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
9629 {
9630 uint32 spellId = vehicle->m_spells[i];
9631 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
9632 if (!spellInfo)
9633 {
9634 data << uint16(0) << uint8(0) << uint8(i + 8);
9635 continue;
9636 }
9637
9638 ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId);
9639 if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions))
9640 {
9641 LOG_DEBUG("condition", "VehicleSpellInitialize: conditions not met for Vehicle entry {} spell {}", vehicle->ToCreature()->GetEntry(), spellId);
9642 data << uint16(0) << uint8(0) << uint8(i + 8);
9643 continue;
9644 }
9645
9646 if (spellInfo->IsPassive())
9647 vehicle->CastSpell(vehicle, spellId, true);
9648
9649 data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i + 8));
9650 }
9651
9653 data << uint32(0);
9654
9655 data << uint8(0); // Auras?
9656
9657 // Cooldowns
9658 data << uint8(cooldownCount);
9659
9660 uint32 curTime = GameTime::GetGameTimeMS().count();
9662
9663 for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
9664 {
9665 uint16 category = itr->second.category;
9666 uint32 cooldown = (itr->second.end > curTime) ? itr->second.end - curTime : 0;
9667
9668 data << uint32(itr->first); // spellid
9669 data << uint16(itr->second.category); // spell category
9670
9671 // send infinity cooldown in special format
9672 if (itr->second.end >= infTime)
9673 {
9674 data << uint32(1); // cooldown
9675 data << uint32(0x80000000); // category cooldown
9676 continue;
9677 }
9678
9679 data << uint32(category ? 0 : cooldown); // cooldown
9680 data << uint32(category ? cooldown : 0); // category cooldown
9681 }
9682
9683 GetSession()->SendPacket(&data);
9684}
#define MAX_SPELL_CONTROL_BAR
Definition CharmInfo.h:27
static constexpr uint32 MAX_CREATURE_SPELLS
Definition Unit.h:46
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:254
uint32 GetTimer()
Definition TemporarySummon.h:58
Creature * GetVehicleCreatureBase() const
Definition Unit.cpp:18835
TempSummon * ToTempSummon()
Definition Unit.h:686
bool IsSummon() const
Definition Unit.h:744

References Unit::CastSpell(), Object::GetEntry(), GameTime::GetGameTimeMS(), Object::GetGUID(), Creature::GetReactState(), GetSession(), TempSummon::GetTimer(), Unit::GetVehicleCreatureBase(), infinityCooldownDelayCheck, SpellInfo::IsPassive(), Unit::IsSummon(), LOG_DEBUG, Creature::m_CreatureSpellCooldowns, Creature::m_spells, MAKE_UNIT_ACTION_BUTTON, MAX_CREATURE_SPELLS, MAX_SPELL_CONTROL_BAR, sConditionMgr, WorldSession::SendPacket(), SMSG_PET_SPELLS, sSpellMgr, Object::ToCreature(), and Unit::ToTempSummon().

Referenced by Unit::SetCharmedBy().

◆ VisualizeItem()

void Player::VisualizeItem ( uint8  slot,
Item pItem 
)
2876{
2877 if (!pItem)
2878 return;
2879
2880 // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
2882 pItem->SetBinding(true);
2883
2884 LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = {}, item = {}", slot, pItem->GetEntry());
2885
2886 m_items[slot] = pItem;
2887 SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
2890 pItem->SetSlot(slot);
2891 pItem->SetContainer(nullptr);
2892
2893 if (slot < EQUIPMENT_SLOT_END)
2894 SetVisibleItemSlot(slot, pItem);
2895
2896 pItem->SetState(ITEM_CHANGED, this);
2897}

References BIND_QUEST_ITEM, BIND_WHEN_EQUIPPED, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, EQUIPMENT_SLOT_END, Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), Item::GetTemplate(), ITEM_CHANGED, ITEM_FIELD_CONTAINED, ITEM_FIELD_OWNER, LOG_DEBUG, m_items, PLAYER_FIELD_INV_SLOT_HEAD, Item::SetBinding(), Item::SetContainer(), Object::SetGuidValue(), Item::SetSlot(), Item::SetState(), and SetVisibleItemSlot().

Referenced by EquipItem(), and QuickEquipItem().

◆ Whisper() [1/2]

void Player::Whisper ( std::string_view  text,
Language  language,
Player receiver,
bool  = false 
)
overridevirtual

Handles whispers from Addons and players based on sender, receiver's guid and language.

Reimplemented from Unit.

9445{
9446 ASSERT(target);
9447
9448 bool isAddonMessage = language == LANG_ADDON;
9449
9450 if (!isAddonMessage) // if not addon data
9451 language = LANG_UNIVERSAL; // whispers should always be readable
9452
9453 std::string _text(text);
9454
9455 if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_WHISPER, language, _text, target))
9456 {
9457 return;
9458 }
9459
9460 sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
9461
9462 WorldPacket data;
9463 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
9464 target->GetSession()->SendPacket(&data);
9465
9466 // rest stuff shouldn't happen in case of addon message
9467 if (isAddonMessage)
9468 return;
9469
9470 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER_INFORM, Language(language), target, target, _text);
9471 GetSession()->SendPacket(&data);
9472
9473 if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster())
9474 {
9475 SetAcceptWhispers(true);
9477 }
9478
9479 // announce afk or dnd message
9480 if (target->isAFK())
9481 {
9482 ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, target->GetName(), target->autoReplyMsg);
9483 }
9484 else if (target->isDND())
9485 {
9486 ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, target->GetName(), target->autoReplyMsg);
9487 }
9488}
@ LANG_PLAYER_DND
Definition Language.h:678
@ LANG_PLAYER_AFK
Definition Language.h:679
@ LANG_COMMAND_WHISPERON
Definition Language.h:335
@ CHAT_MSG_WHISPER_INFORM
Definition SharedDefines.h:3400
@ CHAT_MSG_WHISPER
Definition SharedDefines.h:3398
Language
Definition SharedDefines.h:734
@ LANG_ADDON
Definition SharedDefines.h:753
bool isAcceptWhispers() const
Definition Player.h:1175

References ASSERT, autoReplyMsg, ChatHandler::BuildChatPacket(), CHAT_MSG_WHISPER, CHAT_MSG_WHISPER_INFORM, WorldObject::GetName(), GetSession(), isAcceptWhispers(), isAFK(), isDND(), IsGameMaster(), LANG_ADDON, LANG_COMMAND_WHISPERON, LANG_PLAYER_AFK, LANG_PLAYER_DND, LANG_UNIVERSAL, ChatHandler::PSendSysMessage(), WorldSession::SendPacket(), ChatHandler::SendSysMessage(), SetAcceptWhispers(), and sScriptMgr.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ Whisper() [2/2]

void Player::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
overridevirtual

Reimplemented from Unit.

9491{
9492 if (!target)
9493 return;
9494
9495 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
9496 if (!bct)
9497 {
9498 LOG_ERROR("entities.unit", "Player::Whisper: `broadcast_text` was not {} found", textId);
9499 return;
9500 }
9501
9503 WorldPacket data;
9504 if (isBossWhisper)
9505 ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
9506 else
9507 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
9508 target->SendDirectMessage(&data);
9509}
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3433
std::string const & GetText(LocaleConstant locale=DEFAULT_LOCALE, uint8 gender=GENDER_MALE, bool forceGender=false) const
Definition ObjectMgr.h:456

References ChatHandler::BuildChatPacket(), CHAT_MSG_RAID_BOSS_WHISPER, CHAT_MSG_WHISPER, Unit::getGender(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Player::Yell ( std::string_view  text,
Language  language,
WorldObject const *  = nullptr 
)
overridevirtual

Handles yelled message in regular chat based on declared language and in config pre-defined Range.

Reimplemented from Unit.

9393{
9394 std::string _text(text);
9395
9396 if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_YELL, language, _text))
9397 {
9398 return;
9399 }
9400
9401 sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
9402
9403 WorldPacket data;
9404 ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
9405
9406 SendDirectMessage(&data);
9407
9408 // Special handling for messages, do not use visibility map for stealthed units
9409 Acore::MessageDistDeliverer notifier(this, &data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), false, nullptr, true);
9410 Cell::VisitObjects(this, notifier, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL));
9411}
@ CHAT_MSG_YELL
Definition SharedDefines.h:3397
@ CONFIG_LISTEN_RANGE_YELL
Definition WorldConfig.h:149

References ChatHandler::BuildChatPacket(), CHAT_MSG_YELL, CONFIG_LISTEN_RANGE_YELL, SendDirectMessage(), sScriptMgr, sWorld, and Cell::VisitObjects().

Referenced by WorldSession::HandleMessagechatOpcode().

◆ Yell() [2/2]

void Player::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
overridevirtual

Reimplemented from Unit.

9414{
9415 Talk(textId, CHAT_MSG_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
9416}

References CHAT_MSG_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Friends And Related Symbol Documentation

◆ CinematicMgr

friend class CinematicMgr
friend

Referenced by Player().

◆ Item::AddToUpdateQueueOf

void Item::AddToUpdateQueueOf ( Player player)
friend

◆ Item::RemoveFromUpdateQueueOf

void Item::RemoveFromUpdateQueueOf ( Player player)
friend

◆ WorldSession

friend class WorldSession
friend

Member Data Documentation

◆ _activeCheats

uint32 Player::_activeCheats
private

◆ _BgBattlegroundQueueID

◆ _cinematicMgr

CinematicMgr* Player::_cinematicMgr
private

◆ _corpseLocation

◆ _farSightDistance

Optional<float> Player::_farSightDistance = { }
private

◆ _innTriggerId

uint32 Player::_innTriggerId
protected

◆ _instanceResetTimes

◆ _pendingBindId

uint32 Player::_pendingBindId
private

◆ _pendingBindTimer

uint32 Player::_pendingBindTimer
private

Referenced by SetPendingBind(), and Update().

◆ _restBonus

float Player::_restBonus
protected

◆ _restFlagMask

uint32 Player::_restFlagMask
protected

◆ _restTime

time_t Player::_restTime
protected

◆ _wasOutdoor

bool Player::_wasOutdoor
private

◆ autoReplyMsg

std::string Player::autoReplyMsg

◆ bgZoneIdToFillWorldStates

std::unordered_map< int, bgZoneRef > Player::bgZoneIdToFillWorldStates = {}
static
16206{
16207 SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER
16208 SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER
16209};
16210
16211// 2^n values, Player::m_isunderwater is a bitmask. These are Trinity internal values, they are never send to any client
16213{
16214 UNDERWATER_NONE = 0x00,
16215 UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
16216 UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
16217 UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
16218 UNDERWATER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
16219
16221};
16222
16224{
16228 ERR_BANKSLOT_OK = 3
16229};
16230
16232{
16235 PLAYERSPELL_NEW = 2,
16238};
16239
16240struct PlayerSpell
16241{
16242 PlayerSpellState State : 7; // UPPER CASE TO CAUSE CONSOLE ERRORS (CHECK EVERY USAGE)!
16243 bool Active : 1; // UPPER CASE TO CAUSE CONSOLE ERRORS (CHECK EVERY USAGE)! lower rank of a spell are not useable, but learnt
16244 uint8 specMask : 8;
16245 bool IsInSpec(uint8 spec) { return (specMask & (1 << spec)); }
16246};
16247
16248struct PlayerTalent
16249{
16250 PlayerSpellState State : 8; // UPPER CASE TO CAUSE CONSOLE ERRORS (CHECK EVERY USAGE)!
16251 uint8 specMask : 8;
16252 uint32 talentID;
16253 bool inSpellBook;
16254 bool IsInSpec(uint8 spec) { return (specMask & (1 << spec)); }
16255};
16256
16257enum TalentTree // talent tabs
16258{
16289};
16290
16291#define SPEC_MASK_ALL 255
16292
16293// Spell modifier (used for modify other spells)
16294struct SpellModifier
16295{
16296 SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), mask(), ownerAura(_ownerAura) {}
16297 SpellModOp op : 8;
16298 SpellModType type : 8;
16299 int16 charges : 16;
16300 int32 value{0};
16301 flag96 mask;
16302 uint32 spellId{0};
16303 Aura* const ownerAura;
16304 uint32 priority{0};
16305};
16306
16307typedef std::unordered_map<uint32, PlayerTalent*> PlayerTalentMap;
16308typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
16309typedef std::list<SpellModifier*> SpellModList;
16310
16312
16313struct SpellCooldown
16314{
16315 uint32 end;
16316 uint16 category;
16317 uint32 itemid;
16318 uint32 maxduration;
16319 bool sendToSpectator: 1;
16320 bool needSendToClient: 1;
16321};
16322
16323typedef std::map<uint32, SpellCooldown> SpellCooldowns;
16324typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap;
16325
16327{
16331 TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed
16332};
16333
16335{
16338 ACTIONBUTTON_NEW = 2,
16340};
16341
16343{
16344 ACTION_BUTTON_SPELL = 0x00,
16345 ACTION_BUTTON_C = 0x01, // click?
16346 ACTION_BUTTON_EQSET = 0x20,
16347 ACTION_BUTTON_MACRO = 0x40,
16349 ACTION_BUTTON_ITEM = 0x80
16350};
16351
16353{
16361};
16362
16363enum QuestSound
16364{
16366};
16367
16368#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
16369#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
16370#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
16371
16372struct ActionButton
16373{
16374 ActionButton() = default;
16375
16376 uint32 packedData{0};
16378
16379 // helpers
16380 [[nodiscard]] ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
16381 [[nodiscard]] uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
16382 void SetActionAndType(uint32 action, ActionButtonType type)
16383 {
16384 uint32 newData = action | (uint32(type) << 24);
16385 if (newData != packedData || uState == ACTIONBUTTON_DELETED)
16386 {
16387 packedData = newData;
16388 if (uState != ACTIONBUTTON_NEW)
16389 uState = ACTIONBUTTON_CHANGED;
16390 }
16391 }
16392};
16393
16394#define MAX_ACTION_BUTTONS 144 //checked in 3.2.0
16395
16396typedef std::map<uint8, ActionButton> ActionButtonList;
16397
16399{
16400 PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {}
16401
16402 uint32 item_id;
16403 uint32 item_amount;
16404};
16405
16406typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
16407
16409{
16410 PlayerClassLevelInfo() = default;
16411 uint32 basehealth{0};
16412 uint32 basemana{0};
16413};
16414
16415struct PlayerClassInfo
16416{
16417 PlayerClassInfo() = default;
16418
16419 PlayerClassLevelInfo* levelInfo{nullptr}; //[level-1] 0..MaxPlayerLevel-1
16420};
16421
16422struct PlayerLevelInfo
16423{
16425 {
16426 stats.fill(0);
16427 }
16428
16429 std::array<uint32, MAX_STATS> stats = { };
16430};
16431
16432typedef std::list<uint32> PlayerCreateInfoSpells;
16433
16435{
16436 PlayerCreateInfoAction() = default;
16437 PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {}
16438
16439 uint8 button{0};
16440 uint8 type{0};
16441 uint32 action{0};
16442};
16443
16444typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
16445
16447{
16448 uint16 SkillId;
16449 uint16 Rank;
16450};
16451
16452typedef std::list<PlayerCreateInfoSkill> PlayerCreateInfoSkills;
16453
16454struct PlayerInfo
16455{
16456 // existence checked by displayId != 0
16457 PlayerInfo() = default;
16458
16459 uint32 mapId{0};
16460 uint32 areaId{0};
16461 float positionX{0.0f};
16462 float positionY{0.0f};
16463 float positionZ{0.0f};
16464 float orientation{0.0f};
16465 uint16 displayId_m{0};
16466 uint16 displayId_f{0};
16468 PlayerCreateInfoSpells customSpells;
16469 PlayerCreateInfoSpells castSpells;
16472
16473 PlayerLevelInfo* levelInfo{nullptr}; //[level-1] 0..MaxPlayerLevel-1
16474};
16475
16476struct PvPInfo
16477{
16478 PvPInfo() = default;
16479
16480 bool IsHostile{false};
16481 bool IsInHostileArea{false};
16482 bool IsInNoPvPArea{false};
16483 bool IsInFFAPvPArea{false};
16484 time_t EndTimer{0};
16485 time_t FFAPvPEndTimer{0};
16486};
16487
16488enum DuelState
16489{
16494};
16495
16496struct DuelInfo
16497{
16498 DuelInfo(Player* opponent, Player* initiator, bool isMounted) : Opponent(opponent), Initiator(initiator), IsMounted(isMounted) {}
16499
16500 Player* const Opponent;
16501 Player* const Initiator;
16502 bool const IsMounted;
16504 time_t StartTime = 0;
16505 time_t OutOfBoundsTime = 0;
16506};
16507
16508struct Areas
16509{
16510 uint32 areaID;
16511 uint32 areaFlag;
16512 float x1;
16513 float x2;
16514 float y1;
16515 float y2;
16516};
16517
16518#define MAX_RUNES 6
16519
16520enum RuneCooldowns
16521{
16522 RUNE_BASE_COOLDOWN = 10000,
16523 RUNE_GRACE_PERIOD = 2500, // xinef: maximum possible grace period
16524 RUNE_MISS_COOLDOWN = 1500, // cooldown applied on runes when the spell misses
16525};
16526
16527enum RuneType
16528{
16529 RUNE_BLOOD = 0,
16530 RUNE_UNHOLY = 1,
16531 RUNE_FROST = 2,
16532 RUNE_DEATH = 3,
16533 NUM_RUNE_TYPES = 4
16534};
16535
16536struct RuneInfo
16537{
16538 uint8 BaseRune;
16539 uint8 CurrentRune;
16540 uint32 Cooldown;
16541 uint32 GracePeriod;
16542 AuraEffect const* ConvertAura;
16543};
16544
16545struct Runes
16546{
16547 RuneInfo runes[MAX_RUNES];
16548 uint8 runeState; // mask of available runes
16549 RuneType lastUsedRune;
16550
16551 void SetRuneState(uint8 index, bool set = true)
16552 {
16553 if (set)
16554 runeState |= (1 << index); // usable
16555 else
16556 runeState &= ~(1 << index); // on cooldown
16557 }
16558};
16559
16560struct EnchantDuration
16561{
16562 EnchantDuration() = default;
16563 EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
16564 leftduration(_leftduration) { ASSERT(item); };
16565
16566 Item* item{nullptr};
16568 uint32 leftduration{0};
16569};
16570
16571typedef std::list<EnchantDuration> EnchantDurationList;
16572typedef std::list<Item*> ItemDurationList;
16573
16575{
16576 MOVE_ROOT = 1,
16577 MOVE_UNROOT = 2,
16578 MOVE_WATER_WALK = 3,
16579 MOVE_LAND_WALK = 4
16580};
16581
16582enum DrunkenState
16583{
16584 DRUNKEN_SOBER = 0,
16585 DRUNKEN_TIPSY = 1,
16586 DRUNKEN_DRUNK = 2,
16587 DRUNKEN_SMASHED = 3
16588};
16589
16590#define MAX_DRUNKEN 4
16591
16592enum PlayerFlags : uint32
16593{
16594 PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
16595 PLAYER_FLAGS_AFK = 0x00000002,
16596 PLAYER_FLAGS_DND = 0x00000004,
16597 PLAYER_FLAGS_GM = 0x00000008,
16598 PLAYER_FLAGS_GHOST = 0x00000010,
16599 PLAYER_FLAGS_RESTING = 0x00000020,
16600 PLAYER_FLAGS_UNK6 = 0x00000040,
16601 PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
16602 PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
16603 PLAYER_FLAGS_IN_PVP = 0x00000200,
16604 PLAYER_FLAGS_HIDE_HELM = 0x00000400,
16605 PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
16606 PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
16607 PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
16608 PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000,
16609 PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
16610 PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
16611 PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
16612 PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
16613 PLAYER_FLAGS_UBER = 0x00080000,
16614 PLAYER_FLAGS_UNK20 = 0x00100000,
16615 PLAYER_FLAGS_UNK21 = 0x00200000,
16616 PLAYER_FLAGS_COMMENTATOR2 = 0x00400000,
16617 PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_USES_RANGED_SLOT, SPELL_EFFECT_ATTACK, checked only for active player
16618 PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack
16619 PLAYER_FLAGS_NO_XP_GAIN = 0x02000000,
16620 PLAYER_FLAGS_UNK26 = 0x04000000,
16621 PLAYER_FLAGS_UNK27 = 0x08000000,
16622 PLAYER_FLAGS_UNK28 = 0x10000000,
16623 PLAYER_FLAGS_UNK29 = 0x20000000,
16624 PLAYER_FLAGS_UNK30 = 0x40000000,
16625 PLAYER_FLAGS_UNK31 = 0x80000000,
16626};
16627
16629
16630enum PlayerBytesOffsets //@todo: Implement
16631{
16636};
16637
16638enum PlayerBytes2Offsets //@todo: Implement
16639{
16644};
16645
16646enum PlayerBytes3Offsets //@todo: Implement
16647{
16652};
16653
16654enum PlayerFieldBytesOffsets //@todo: Implement
16655{
16660};
16661
16663{
16667};
16668
16669static_assert((PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID & 1) == 0, "PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID must be aligned to 2 byte boundary");
16670
16671#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET (PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID / 2)
16672
16673#define KNOWN_TITLES_SIZE 3
16674#define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 3 uint64 fields
16675
16676// used in PLAYER_FIELD_BYTES values
16678{
16680 PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
16681 PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x00000010 // Display no "release spirit" window at all
16682};
16683
16684// used in PLAYER_FIELD_BYTES2 values
16686{
16690};
16691
16692enum MirrorTimerType
16693{
16694 FATIGUE_TIMER = 0,
16695 BREATH_TIMER = 1,
16696 FIRE_TIMER = 2
16697};
16698#define MAX_TIMERS 3
16699#define DISABLED_MIRROR_TIMER -1
16700
16701// 2^n values
16703{
16704 // gm abilities
16705 PLAYER_EXTRA_GM_ON = 0x0001,
16707 PLAYER_EXTRA_TAXICHEAT = 0x0008,
16709 PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
16710 PLAYER_EXTRA_HAS_310_FLYER = 0x0040, // Marks if player already has 310% speed flying mount
16711 PLAYER_EXTRA_SPECTATOR_ON = 0x0080, // Marks if player is spectactor
16712 PLAYER_EXTRA_PVP_DEATH = 0x0100, // store PvP death status until corpse creating.
16713 PLAYER_EXTRA_SHOW_DK_PET = 0x0400, // Marks if player should see ghoul on login screen
16715};
16716
16717// 2^n values
16718enum AtLoginFlags
16719{
16720 AT_LOGIN_NONE = 0x00,
16721 AT_LOGIN_RENAME = 0x01,
16722 AT_LOGIN_RESET_SPELLS = 0x02,
16724 AT_LOGIN_CUSTOMIZE = 0x08,
16726 AT_LOGIN_FIRST = 0x20,
16728 AT_LOGIN_CHANGE_RACE = 0x80,
16729 AT_LOGIN_RESET_AP = 0x100,
16730 AT_LOGIN_RESET_ARENA = 0x200,
16731 AT_LOGIN_CHECK_ACHIEVS = 0x400,
16732 AT_LOGIN_RESURRECT = 0x800
16733};
16734
16735typedef std::map<uint32, QuestStatusData> QuestStatusMap;
16736typedef std::unordered_set<uint32> RewardedQuestSet;
16737
16738// quest, keep
16739typedef std::map<uint32, bool> QuestStatusSaveMap;
16740
16742{
16743 QUEST_ID_OFFSET = 0,
16747};
16748
16749#define MAX_QUEST_OFFSET 5
16750
16752{
16753 QUEST_STATE_NONE = 0x0000,
16754 QUEST_STATE_COMPLETE = 0x0001,
16755 QUEST_STATE_FAIL = 0x0002
16756};
16757
16759{
16760 SKILL_UNCHANGED = 0,
16761 SKILL_CHANGED = 1,
16762 SKILL_NEW = 2,
16763 SKILL_DELETED = 3
16764};
16765
16766struct SkillStatusData
16767{
16768 SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState)
16769 {
16770 }
16771 uint8 pos;
16772 SkillUpdateState uState;
16773};
16774
16775typedef std::unordered_map<uint32, SkillStatusData> SkillStatusMap;
16776
16777class Quest;
16778class Spell;
16779class Item;
16780class WorldSession;
16781
16782enum PlayerSlots
16783{
16784 // first slot for item stored (in any way in player m_items data)
16786 // last+1 slot for item stored (in any way in player m_items data)
16787 PLAYER_SLOT_END = 150,
16789};
16790
16791#define INVENTORY_SLOT_BAG_0 255
16792
16793enum EquipmentSlots // 19 slots
16794{
16816};
16817
16818enum InventorySlots // 4 slots
16819{
16822};
16823
16824enum InventoryPackSlots // 16 slots
16825{
16828};
16829
16830enum BankItemSlots // 28 slots
16831{
16834};
16835
16836enum BankBagSlots // 7 slots
16837{
16840};
16841
16842enum BuyBackSlots // 12 slots
16843{
16844 // stored in m_items, there is no more m_buybackitems
16845 BUYBACK_SLOT_START = 74,
16846 BUYBACK_SLOT_END = 86
16847};
16848
16849enum KeyRingSlots // 32 slots
16850{
16851 KEYRING_SLOT_START = 86,
16852 KEYRING_SLOT_END = 118
16853};
16854
16855enum CurrencyTokenSlots // 32 slots
16856{
16859};
16860
16862{
16867};
16868
16869struct EquipmentSet
16870{
16871 EquipmentSet() = default;
16872
16873 uint64 Guid;
16874 std::string Name;
16875 std::string IconName;
16876 uint32 IgnoreMask{0};
16879};
16880
16881#define MAX_EQUIPMENT_SET_INDEX 10 // client limit
16882
16883typedef std::map<uint32, EquipmentSet> EquipmentSets;
16884
16885struct ItemPosCount
16886{
16887 ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) {}
16888 [[nodiscard]] bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
16889 uint16 pos;
16890 uint32 count;
16891};
16892typedef std::vector<ItemPosCount> ItemPosCountVec;
16893
16894struct SavedItem
16895{
16896 Item* item;
16897 uint16 dstpos;
16898
16899 SavedItem(Item* _item, uint16 dstpos) : item(_item), dstpos(dstpos) {}
16900};
16901
16903{
16904 TRANSFER_ABORT_NONE = 0x00,
16905 TRANSFER_ABORT_ERROR = 0x01,
16906 TRANSFER_ABORT_MAX_PLAYERS = 0x02, // Transfer Aborted: instance is full
16907 TRANSFER_ABORT_NOT_FOUND = 0x03, // Transfer Aborted: instance not found
16908 TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x04, // You have entered too many instances recently.
16909 TRANSFER_ABORT_ZONE_IN_COMBAT = 0x06, // Unable to zone in while an encounter is in progress.
16910 TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x07, // You must have <TBC, WotLK> expansion installed to access this area.
16911 TRANSFER_ABORT_DIFFICULTY = 0x08, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
16912 TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place!
16913 TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later.
16914 TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1
16915 TRANSFER_ABORT_NOT_FOUND1 = 0x0C, // 3.1
16916 TRANSFER_ABORT_NOT_FOUND2 = 0x0D, // 3.1
16917 TRANSFER_ABORT_NOT_FOUND3 = 0x0E, // 3.2
16918 TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm.
16919 TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time.
16920};
16921
16923{
16924 RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
16925 RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
16926 RAID_INSTANCE_WARNING_MIN_SOON = 3, // WARNING! %s is scheduled to reset in %d minute(s). Please exit the zone or you will be returned to your bind location!
16927 RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s.
16929};
16930
16931class InstanceSave;
16932
16933enum RestFlag
16934{
16935 REST_FLAG_IN_TAVERN = 0x1,
16936 REST_FLAG_IN_CITY = 0x2,
16937 REST_FLAG_IN_FACTION_AREA = 0x4, // used with AREA_FLAG_REST_ZONE_*
16938};
16939
16941{
16942 TELE_TO_GM_MODE = 0x01,
16946 TELE_TO_SPELL = 0x10,
16948 TELE_TO_WITH_PET = 0x40,
16950};
16951
16954{
16955 DAMAGE_EXHAUSTED = 0,
16956 DAMAGE_DROWNING = 1,
16957 DAMAGE_FALL = 2,
16958 DAMAGE_LAVA = 3,
16959 DAMAGE_SLIME = 4,
16960 DAMAGE_FIRE = 5,
16961 DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
16962};
16963
16964enum PlayerChatTag
16965{
16966 CHAT_TAG_NONE = 0x00,
16967 CHAT_TAG_AFK = 0x01,
16968 CHAT_TAG_DND = 0x02,
16969 CHAT_TAG_GM = 0x04,
16970 CHAT_TAG_COM = 0x08, // Commentator tag. Do not exist in clean client
16971 CHAT_TAG_DEV = 0x10,
16972};
16973
16974enum PlayedTimeIndex
16975{
16978};
16979
16980#define MAX_PLAYED_TIME_INDEX 2
16981
16982// used at player loading query list preparing, and later result selection
16984{
17020};
17021
17023{
17024 DELAYED_SAVE_PLAYER = 0x01,
17032};
17033
17035{
17047};
17048
17049// Player summoning auto-decline time (in secs)
17050#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
17051#define MAX_MONEY_AMOUNT (0x7FFFFFFF-1)
17052
17054{
17055 uint32 id;
17056 TeamId faction;
17057 std::string note;
17058 uint32 priority;
17059 bool checkLeaderOnly;
17060};
17061
17063{
17064 uint8 levelMin;
17065 uint8 levelMax;
17066 uint16 reqItemLevel;
17067 std::vector<ProgressionRequirement*> quests;
17068 std::vector<ProgressionRequirement*> items;
17069 std::vector<ProgressionRequirement*> achievements;
17070};
17071
17073{
17074 CHAR_DELETE_REMOVE = 0, // Completely remove from the database
17075 CHAR_DELETE_UNLINK = 1 // The character gets unlinked from the account,
17076 // the name gets freed up and appears as deleted ingame
17077};
17078
17079enum CurrencyItems
17080{
17081 ITEM_HONOR_POINTS_ID = 43308,
17082 ITEM_ARENA_POINTS_ID = 43307
17083};
17084
17086{
17101};
17102
17103enum PlayerRestState
17104{
17105 REST_STATE_RESTED = 0x01,
17108};
17109
17111{
17115};
17116
17118{
17119 CHEAT_NONE = 0x00,
17120 CHEAT_GOD = 0x01,
17121 CHEAT_CASTTIME = 0x02,
17122 CHEAT_COOLDOWN = 0x04,
17123 CHEAT_POWER = 0x08,
17124 CHEAT_WATERWALK = 0x10
17125};
17126
17127// Used for OnGiveXP PlayerScript hook
17128enum PlayerXPSource
17129{
17130 XPSOURCE_KILL = 0,
17131 XPSOURCE_QUEST = 1,
17133 XPSOURCE_EXPLORE = 3,
17135};
17136
17138{
17140};
17141
17143{
17145};
17146
17147std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
17148
17149class Player;
17150
17151// holder for Battleground data (pussywizard: not stored in db)
17152struct BGData
17153{
17154 BGData() = default;
17155
17156 uint32 bgInstanceID{0};
17158 TeamId bgTeamId{TEAM_NEUTRAL};
17160 bool isInvited{false};
17161 bool bgIsRandom{false};
17162
17163 GuidSet bgAfkReporter;
17164 uint8 bgAfkReportedCount{0};
17165 time_t bgAfkReportedTimer{0};
17166};
17167
17168// holder for Entry Point data (pussywizard: stored in db)
17169struct EntryPointData
17170{
17172 {
17173 ClearTaxiPath();
17174 }
17175
17176 uint32 mountSpell{0};
17177 std::array<uint32, 2> taxiPath;
17178 WorldLocation joinPos;
17179
17180 void ClearTaxiPath() { taxiPath.fill(0); }
17181 [[nodiscard]] bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
17182};
17183
17185{
17186 uint32 spellId;
17187 uint32 category;
17188 WorldPacket requestPacket;
17189 bool isItem = false;
17190 bool cancelInProgress = false;
17191
17192 PendingSpellCastRequest(uint32 spellId, uint32 category, WorldPacket&& packet, bool item = false, bool cancel = false)
17193 : spellId(spellId), category(category), requestPacket(std::move(packet)), isItem(item) , cancelInProgress(cancel) {}
17194};
17195
17196class Player : public Unit, public GridObject<Player>
17197{
17198 friend class WorldSession;
17199 friend class CinematicMgr;
17200 friend void Item::AddToUpdateQueueOf(Player* player);
17201 friend void Item::RemoveFromUpdateQueueOf(Player* player);
17202public:
17203 explicit Player(WorldSession* session);
17204 ~Player() override;
17205
17206 void CleanupsBeforeDelete(bool finalCleanup = true) override;
17207
17208 void AddToWorld() override;
17209 void RemoveFromWorld() override;
17210
17211 void SetObjectScale(float scale) override
17212 {
17213 Unit::SetObjectScale(scale);
17216 }
17217
17218 [[nodiscard]] bool hasSpanishClient()
17219 {
17221 }
17222
17223 bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0, Unit* target = nullptr, bool newInstance = false);
17224 bool TeleportTo(WorldLocation const& loc, uint32 options = 0, Unit* target = nullptr)
17225 {
17226 return TeleportTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), options, target);
17227 }
17228 bool TeleportToEntryPoint();
17229
17230 void SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay = 0, bool asSpectator = false);
17231 [[nodiscard]] bool IsSummonAsSpectator() const;
17232 void SetSummonAsSpectator(bool on) { m_summon_asSpectator = on; }
17233 void SummonIfPossible(bool agree, ObjectGuid summoner_guid);
17234 [[nodiscard]] time_t GetSummonExpireTimer() const { return m_summon_expire; }
17235
17236 bool Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo);
17237
17238 void Update(uint32 time) override;
17239
17241 bool HasPlayerFlag(PlayerFlags flags) const { return HasFlag(PLAYER_FLAGS, flags) != 0; }
17242 void SetPlayerFlag(PlayerFlags flags) { SetFlag(PLAYER_FLAGS, flags); }
17243 void RemovePlayerFlag(PlayerFlags flags) { RemoveFlag(PLAYER_FLAGS, flags); }
17245
17246 static bool BuildEnumData(PreparedQueryResult result, WorldPacket* data);
17247
17248 [[nodiscard]] bool IsClass(Classes playerClass, ClassContext context = CLASS_CONTEXT_NONE) const override;
17249
17250 void SetInWater(bool apply);
17251
17252 [[nodiscard]] bool IsInWater() const override { return m_isInWater; }
17253 [[nodiscard]] bool IsFalling() const;
17254 bool IsInAreaTriggerRadius(AreaTrigger const* trigger, float delta = 0.f) const;
17255
17258 void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
17259 void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap);
17260
17261 bool CanInteractWithQuestGiver(Object* questGiver);
17264
17265 void ToggleAFK();
17266 void ToggleDND();
17267 [[nodiscard]] bool isAFK() const { return HasPlayerFlag(PLAYER_FLAGS_AFK); }
17268 [[nodiscard]] bool isDND() const { return HasPlayerFlag(PLAYER_FLAGS_DND); }
17269 [[nodiscard]] uint8 GetChatTag() const;
17270 std::string autoReplyMsg;
17271
17272 uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin = nullptr);
17273
17274 PlayerSocial* GetSocial() { return m_social; }
17275
17278 bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 1);
17279 bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 1);
17281 void ContinueTaxiFlight();
17283 // mount_id can be used in scripting calls
17284
17285 [[nodiscard]] bool IsCommentator() const { return HasPlayerFlag(PLAYER_FLAGS_COMMENTATOR2); }
17287 [[nodiscard]] bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); }
17289 [[nodiscard]] bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
17290 void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
17291 [[nodiscard]] bool IsGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
17292 void SetGameMaster(bool on);
17293 [[nodiscard]] bool isGMChat() const { return m_ExtraFlags & PLAYER_EXTRA_GM_CHAT; }
17294 void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
17295 [[nodiscard]] bool IsGMSpectator() const { return m_ExtraFlags & PLAYER_EXTRA_GM_SPECTATOR; }
17296 void SetGMSpectator(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_SPECTATOR; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_SPECTATOR; }
17297
17298 [[nodiscard]] bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; }
17299 void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
17300 [[nodiscard]] bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
17301 void SetGMVisible(bool on);
17302 bool Has310Flyer(bool checkAllSpells, uint32 excludeSpellId = 0);
17303 void SetHas310Flyer(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_HAS_310_FLYER; else m_ExtraFlags &= ~PLAYER_EXTRA_HAS_310_FLYER; }
17304 void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
17305
17306 void GiveXP(uint32 xp, Unit* victim, float group_rate = 1.0f, bool isLFGReward = false);
17307 void GiveLevel(uint8 level);
17308
17309 void InitStatsForLevel(bool reapplyMods = false);
17310
17311 [[nodiscard]] bool HasActivePowerType(Powers power) override;
17312
17313 // .cheat command related
17314 [[nodiscard]] bool GetCommandStatus(uint32 command) const { return _activeCheats & command; }
17315 void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
17316 void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
17317
17318 // Played Time Stuff
17319 time_t m_logintime;
17320 time_t m_Last_tick;
17324
17325 void setDeathState(DeathState s, bool despawn = false) override; // overwrite Unit::setDeathState
17326
17327 void SetRestState(uint32 triggerId);
17328 void RemoveRestState();
17330 [[nodiscard]] float GetRestBonus() const { return _restBonus; }
17331 void SetRestBonus(float restBonusNew);
17332
17333 [[nodiscard]] bool HasRestFlag(RestFlag restFlag) const { return (_restFlagMask & restFlag) != 0; }
17334 void SetRestFlag(RestFlag restFlag, uint32 triggerId = 0);
17335 void RemoveRestFlag(RestFlag restFlag);
17336 [[nodiscard]] uint32 GetInnTriggerId() const { return _innTriggerId; }
17337
17338 PetStable* GetPetStable() { return m_petStable.get(); }
17340 [[nodiscard]] PetStable const* GetPetStable() const { return m_petStable.get(); }
17341
17342 [[nodiscard]] Pet* GetPet() const;
17343 Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0s, uint32 healthPct = 0);
17344 void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
17345 bool CanPetResurrect();
17346 bool IsExistPet();
17347 Pet* CreatePet(Creature* creatureTarget, uint32 spellID = 0);
17348 Pet* CreatePet(uint32 creatureEntry, uint32 spellID = 0);
17349
17350 [[nodiscard]] uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
17351
17353 void Say(std::string_view text, Language language, WorldObject const* = nullptr) override;
17354 void Say(uint32 textId, WorldObject const* target = nullptr) override;
17356 void Yell(std::string_view text, Language language, WorldObject const* = nullptr) override;
17357 void Yell(uint32 textId, WorldObject const* target = nullptr) override;
17359 void TextEmote(std::string_view text, WorldObject const* = nullptr, bool = false) override;
17360 void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false) override;
17362 void Whisper(std::string_view text, Language language, Player* receiver, bool = false) override;
17363 void Whisper(uint32 textId, Player* target, bool isBossWhisper = false) override;
17364
17365 /*********************************************************/
17366 /*** STORAGE SYSTEM ***/
17367 /*********************************************************/
17368
17369 void SetVirtualItemSlot(uint8 i, Item* item);
17370 void SetSheath(SheathState sheathed) override; // overwrite Unit version
17371 uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
17372 uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
17373 uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
17374 [[nodiscard]] Item* GetItemByGuid(ObjectGuid guid) const;
17375 [[nodiscard]] Item* GetItemByEntry(uint32 entry) const;
17376 [[nodiscard]] Item* GetItemByPos(uint16 pos) const;
17377 [[nodiscard]] Item* GetItemByPos(uint8 bag, uint8 slot) const;
17378 [[nodiscard]] Bag* GetBagByPos(uint8 slot) const;
17379 [[nodiscard]] uint32 GetFreeInventorySpace() const;
17380 [[nodiscard]] inline Item* GetUseableItemByPos(uint8 bag, uint8 slot) const //Does additional check for disarmed weapons
17381 {
17383 return nullptr;
17384 return GetItemByPos(bag, slot);
17385 }
17386 [[nodiscard]] Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
17387 bool HasWeapon(WeaponAttackType type) const override { return GetWeaponForAttack(type, false); }
17388 bool HasWeaponForAttack(WeaponAttackType type) const override { return (Unit::HasWeaponForAttack(type) && GetWeaponForAttack(type, true)); }
17389 [[nodiscard]] Item* GetShield(bool useable = false) const;
17390 static uint8 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot
17391 std::vector<Item*>& GetItemUpdateQueue() { return m_itemUpdateQueue; }
17392 static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
17393 static bool IsInventoryPos(uint8 bag, uint8 slot);
17394 static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8, pos & 255); }
17395 static bool IsEquipmentPos(uint8 bag, uint8 slot);
17396 static bool IsBagPos(uint16 pos);
17397 static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8, pos & 255); }
17398 static bool IsBankPos(uint8 bag, uint8 slot);
17399 bool IsValidPos(uint16 pos, bool explicit_pos) { return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
17400 bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos);
17401 [[nodiscard]] uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
17402 void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
17403 [[nodiscard]] bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
17404 bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const;
17405 bool CanNoReagentCast(SpellInfo const* spellInfo) const;
17406 [[nodiscard]] bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
17407 [[nodiscard]] bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
17408 InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
17409 [[nodiscard]] InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, nullptr); }
17410 InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const
17411 {
17412 return CanStoreItem(bag, slot, dest, item, count, nullptr, false, no_space_count);
17413 }
17414 InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const
17415 {
17416 if (!pItem)
17418 uint32 count = pItem->GetCount();
17419 return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, nullptr);
17420 }
17421 InventoryResult CanStoreItems(Item** pItem, int32 count) const;
17422 InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
17423 InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
17424
17425 InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
17426 InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
17427 [[nodiscard]] InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
17428 [[nodiscard]] InventoryResult CanUnequipItem(uint16 src, bool swap) const;
17429 InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const;
17430 InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
17431 [[nodiscard]] bool HasItemTotemCategory(uint32 TotemCategory) const;
17432 bool IsTotemCategoryCompatiableWith(ItemTemplate const* pProto, uint32 requiredTotemCategoryId) const;
17433 InventoryResult CanUseItem(ItemTemplate const* pItem) const;
17434 [[nodiscard]] InventoryResult CanUseAmmo(uint32 item) const;
17435 InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
17436 Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
17437 Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters);
17438 Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
17439 Item* EquipNewItem(uint16 pos, uint32 item, bool update);
17440 Item* EquipItem(uint16 pos, Item* pItem, bool update);
17441 void AutoUnequipOffhandIfNeed(bool force = false);
17442 bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
17443 void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false);
17444 void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
17445 LootItem* StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg);
17446 void UpdateLootAchievements(LootItem* item, Loot* loot);
17447 void UpdateTitansGrip();
17448
17449 InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr) const;
17450 InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = nullptr, bool swap = false, uint32* no_space_count = nullptr) const;
17451
17452 void AddRefundReference(ObjectGuid itemGUID);
17453 void DeleteRefundReference(ObjectGuid itemGUID);
17454
17455 void ApplyEquipCooldown(Item* pItem);
17456 void SetAmmo(uint32 item);
17457 void RemoveAmmo();
17458 [[nodiscard]] float GetAmmoDPS() const { return m_ammoDPS; }
17459 bool CheckAmmoCompatibility(ItemTemplate const* ammo_proto) const;
17460 void QuickEquipItem(uint16 pos, Item* pItem);
17461 void VisualizeItem(uint8 slot, Item* pItem);
17462 void SetVisibleItemSlot(uint8 slot, Item* pItem);
17463 Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update)
17464 {
17465 return StoreItem(dest, pItem, update);
17466 }
17467 Item* BankItem(uint16 pos, Item* pItem, bool update);
17468 void RemoveItem(uint8 bag, uint8 slot, bool update, bool swap = false);
17469 void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
17470 // in trade, auction, guild bank, mail....
17471 void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
17472 // in trade, guild bank, mail....
17474 void DestroyItem(uint8 bag, uint8 slot, bool update);
17475 void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
17476 void DestroyItemCount(Item* item, uint32& count, bool update);
17477 void DestroyConjuredItems(bool update);
17478 void DestroyZoneLimitedItem(bool update, uint32 new_zone);
17479 void SplitItem(uint16 src, uint16 dst, uint32 count);
17480 void SwapItem(uint16 src, uint16 dst);
17481 void AddItemToBuyBackSlot(Item* pItem, uint32 money);
17483 void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
17484 [[nodiscard]] uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END - KEYRING_SLOT_START; }
17485 void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = nullptr, uint32 itemid = 0);
17486 void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
17487 void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid, uint32 param);
17488 void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
17489 void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
17490 [[nodiscard]] uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
17491 [[nodiscard]] uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
17492
17493 [[nodiscard]] bool IsTwoHandUsed() const
17494 {
17496 return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
17497 }
17498 void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false, bool sendChatMessage = true);
17499 bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
17500 bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
17501
17502 [[nodiscard]] float GetReputationPriceDiscount(Creature const* creature) const;
17503 [[nodiscard]] float GetReputationPriceDiscount(FactionTemplateEntry const* factionTemplate) const;
17504
17505 [[nodiscard]] Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; }
17506 [[nodiscard]] TradeData* GetTradeData() const { return m_trade; }
17507 void TradeCancel(bool sendback, TradeStatus status = TRADE_STATUS_TRADE_CANCELED);
17508
17509 CinematicMgr* GetCinematicMgr() const { return _cinematicMgr; }
17510
17511 void UpdateEnchantTime(uint32 time);
17513 void AddTradeableItem(Item* item);
17514 void RemoveTradeableItem(Item* item);
17515 void UpdateItemDuration(uint32 time, bool realtimeonly = false);
17516 void AddEnchantmentDurations(Item* item);
17517 void RemoveEnchantmentDurations(Item* item);
17518 void RemoveEnchantmentDurationsReferences(Item* item); // pussywizard
17520 void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration);
17521 void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false);
17522 void ApplyEnchantment(Item* item, bool apply);
17523 void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value);
17527 void AddItemDurations(Item* item);
17528 void RemoveItemDurations(Item* item);
17529 void SendItemDurations();
17530 void LoadCorpse(PreparedQueryResult result);
17531 void LoadPet();
17532
17533 bool AddItem(uint32 itemId, uint32 count);
17534
17535 /*********************************************************/
17536 /*** GOSSIP SYSTEM ***/
17537 /*********************************************************/
17538
17539 void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
17540 void SendPreparedGossip(WorldObject* source);
17541 void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
17542
17543 uint32 GetGossipTextId(uint32 menuId, WorldObject* source);
17546
17547 void ToggleInstantFlight();
17548
17549 /*********************************************************/
17550 /*** QUEST SYSTEM ***/
17551 /*********************************************************/
17552
17553 int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : GetLevel(); }
17554
17555 void PrepareQuestMenu(ObjectGuid guid);
17556 void SendPreparedQuest(ObjectGuid guid);
17557 [[nodiscard]] bool IsActiveQuest(uint32 quest_id) const;
17558 Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest);
17559 bool CanSeeStartQuest(Quest const* quest);
17560 bool CanTakeQuest(Quest const* quest, bool msg);
17561 bool CanAddQuest(Quest const* quest, bool msg);
17562 bool CanCompleteQuest(uint32 quest_id, const QuestStatusData* q_savedStatus = nullptr);
17563 bool CanCompleteRepeatableQuest(Quest const* quest);
17564 bool CanRewardQuest(Quest const* quest, bool msg);
17565 bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg);
17566 void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver);
17567 void AddQuest(Quest const* quest, Object* questGiver);
17568 void AbandonQuest(uint32 quest_id);
17569 void CompleteQuest(uint32 quest_id);
17570 void IncompleteQuest(uint32 quest_id);
17571 void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true, bool isLFGReward = false);
17572 void SetRewardedQuest(uint32 quest_id);
17573 void FailQuest(uint32 quest_id);
17574 bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
17575 bool SatisfyQuestLevel(Quest const* qInfo, bool msg) const;
17576 bool SatisfyQuestLog(bool msg);
17577 bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) const;
17578 bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
17579 bool SatisfyQuestRace(Quest const* qInfo, bool msg) const;
17580 bool SatisfyQuestReputation(Quest const* qInfo, bool msg) const;
17581 bool SatisfyQuestStatus(Quest const* qInfo, bool msg) const;
17582 bool SatisfyQuestConditions(Quest const* qInfo, bool msg);
17583 bool SatisfyQuestTimed(Quest const* qInfo, bool msg) const;
17584 bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const;
17585 bool SatisfyQuestNextChain(Quest const* qInfo, bool msg) const;
17586 bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg) const;
17587 bool SatisfyQuestDay(Quest const* qInfo, bool msg) const;
17588 bool SatisfyQuestWeek(Quest const* qInfo, bool msg) const;
17589 bool SatisfyQuestMonth(Quest const* qInfo, bool msg) const;
17590 bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg) const;
17591 bool GiveQuestSourceItem(Quest const* quest);
17592 bool TakeQuestSourceItem(uint32 questId, bool msg);
17593 uint32 CalculateQuestRewardXP(Quest const* quest);
17594 [[nodiscard]] bool GetQuestRewardStatus(uint32 quest_id) const;
17595 [[nodiscard]] QuestStatus GetQuestStatus(uint32 quest_id) const;
17596 void SetQuestStatus(uint32 questId, QuestStatus status, bool update = true);
17597 void RemoveActiveQuest(uint32 questId, bool update = true);
17598 void RemoveRewardedQuest(uint32 questId, bool update = true);
17599 void SendQuestUpdate(uint32 questId);
17601 float GetQuestRate(bool isDFQuest = false);
17602 void SetDailyQuestStatus(uint32 quest_id);
17603 bool IsDailyQuestDone(uint32 quest_id);
17604 void SetWeeklyQuestStatus(uint32 quest_id);
17605 void SetMonthlyQuestStatus(uint32 quest_id);
17606 void SetSeasonalQuestStatus(uint32 quest_id);
17607 void ResetDailyQuestStatus();
17610 void ResetSeasonalQuestStatus(uint16 event_id);
17611
17612 [[nodiscard]] uint16 FindQuestSlot(uint32 quest_id) const;
17615 [[nodiscard]] uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const { return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16)); }
17617 void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer = 0)
17618 {
17624 }
17625 void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count)
17626 {
17628 val &= ~((uint64)0xFFFF << (counter * 16));
17629 val |= ((uint64)count << (counter * 16));
17631 }
17635 void SwapQuestSlot(uint16 slot1, uint16 slot2)
17636 {
17637 for (int i = 0; i < MAX_QUEST_OFFSET; ++i)
17638 {
17641
17644 }
17645 }
17647 void AreaExploredOrEventHappens(uint32 questId);
17648 void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
17649 void ItemAddedQuestCheck(uint32 entry, uint32 count);
17650 void ItemRemovedQuestCheck(uint32 entry, uint32 count);
17651 void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
17653 void KilledPlayerCredit(uint16 count = 1);
17654 void KilledPlayerCreditForQuest(uint16 count, Quest const* quest);
17655 void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
17656 void TalkedToCreature(uint32 entry, ObjectGuid guid);
17657 void MoneyChanged(uint32 value);
17658 void ReputationChanged(FactionEntry const* factionEntry);
17659 void ReputationChanged2(FactionEntry const* factionEntry);
17660 [[nodiscard]] bool HasQuestForItem(uint32 itemId, uint32 excludeQuestId = 0, bool turnIn = false, bool* showInLoot = nullptr) const;
17661 [[nodiscard]] bool HasQuestForGO(int32 GOId) const;
17662 [[nodiscard]] bool HasQuest(uint32 questId) const;
17664 [[nodiscard]] bool CanShareQuest(uint32 quest_id) const;
17665
17666 void SendQuestComplete(uint32 quest_id);
17667 void SendQuestReward(Quest const* quest, uint32 XP);
17668 void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
17669 void SendQuestTimerFailed(uint32 quest_id);
17670 void SendCanTakeQuestResponse(uint32 msg) const;
17671 void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
17672 void SendPushToPartyResponse(Player const* player, uint8 msg) const;
17673 void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);
17674 void SendQuestUpdateAddCreatureOrGo(Quest const* quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count);
17675 void SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint16 add_count);
17676
17677 ObjectGuid GetDivider() { return m_divider; }
17678 void SetDivider(ObjectGuid guid = ObjectGuid::Empty) { m_divider = guid; }
17679
17680 uint32 GetInGameTime() { return m_ingametime; }
17681
17682 void SetInGameTime(uint32 time) { m_ingametime = time; }
17683
17684 void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); }
17685 void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); }
17686
17687 [[nodiscard]] bool HasPvPForcingQuest() const;
17688
17689 /*********************************************************/
17690 /*** LOAD SYSTEM ***/
17691 /*********************************************************/
17692
17693 bool LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& holder);
17694 [[nodiscard]] bool isBeingLoaded() const override;
17695
17697 static uint32 GetZoneIdFromDB(ObjectGuid guid);
17698 static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid::LowType guid);
17699
17700 static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
17701
17702 /*********************************************************/
17703 /*** SAVE SYSTEM ***/
17704 /*********************************************************/
17705
17706 void SaveToDB(bool create, bool logout);
17707 void SaveToDB(CharacterDatabaseTransaction trans, bool create, bool logout);
17708 void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans); // fast save function for item/money cheating preventing
17711
17712 static void Customize(CharacterCustomizeInfo const* customizeInfo, CharacterDatabaseTransaction trans);
17713 static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid);
17714 static void SavePositionInDB(WorldLocation const& loc, uint16 zoneId, ObjectGuid guid, CharacterDatabaseTransaction trans);
17715
17716 static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally);
17717 static void DeleteOldCharacters();
17718 static void DeleteOldCharacters(uint32 keepDays);
17719
17720 static void DeleteOldRecoveryItems();
17721 static void DeleteOldRecoveryItems(uint32 keepDays);
17722
17723 bool m_mailsUpdated;
17724
17725 void SetBindPoint(ObjectGuid guid);
17727 void ResetPetTalents();
17728 void CalcRage(uint32 damage, bool attacker);
17729 void RegenerateAll();
17730 void Regenerate(Powers power);
17731 void RegenerateHealth();
17732 void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
17734
17735 [[nodiscard]] uint32 GetMoney() const { return GetUInt32Value(PLAYER_FIELD_COINAGE); }
17736 bool ModifyMoney(int32 amount, bool sendError = true);
17737 [[nodiscard]] bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); }
17738 [[nodiscard]] bool HasEnoughMoney(int32 amount) const
17739 {
17740 if (amount > 0)
17741 return (GetMoney() >= (uint32) amount);
17742 return true;
17743 }
17744
17745 void SetMoney(uint32 value)
17746 {
17748 MoneyChanged(value);
17750 }
17751
17752 [[nodiscard]] RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
17755
17756 [[nodiscard]] std::size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
17757 [[nodiscard]] bool IsQuestRewarded(uint32 quest_id) const
17758 {
17759 return m_RewardedQuests.find(quest_id) != m_RewardedQuests.end();
17760 }
17761
17762 [[nodiscard]] Unit* GetSelectedUnit() const;
17763 [[nodiscard]] Player* GetSelectedPlayer() const;
17764
17765 void SetTarget(ObjectGuid /*guid*/ = ObjectGuid::Empty) override { }
17766 void SetSelection(ObjectGuid guid);
17767
17768 void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType item_guid = 0, uint32 item_count = 0);
17769 void SendNewMail();
17771 void AddNewMailDeliverTime(time_t deliver_time);
17772
17773 void RemoveMail(uint32 id);
17774
17775 void AddMail(Mail* mail) { m_mail.push_front(mail); }// for call from WorldSession::SendMailTo
17776 uint32 GetMailSize() { return m_mail.size();}
17777 Mail* GetMail(uint32 id);
17778
17779 [[nodiscard]] PlayerMails const& GetMails() const { return m_mail; }
17780 void SendItemRetrievalMail(uint32 itemEntry, uint32 count); // Item retrieval mails sent by The Postmaster (34337)
17781 void SendItemRetrievalMail(std::vector<std::pair<uint32, uint32>> mailItems); // Item retrieval mails sent by The Postmaster (34337)
17782
17783 /*********************************************************/
17784 /*** MAILED ITEMS SYSTEM ***/
17785 /*********************************************************/
17786
17789
17790 typedef std::unordered_map<ObjectGuid::LowType, Item*> ItemMap;
17791
17792 ItemMap mMitems; //template defined in objectmgr.cpp
17793
17794 Item* GetMItem(ObjectGuid::LowType itemLowGuid)
17795 {
17796 ItemMap::const_iterator itr = mMitems.find(itemLowGuid);
17797 return itr != mMitems.end() ? itr->second : nullptr;
17798 }
17799
17800 void AddMItem(Item* it)
17801 {
17802 ASSERT(it);
17803 //ASSERT deleted, because items can be added before loading
17804 mMitems[it->GetGUID().GetCounter()] = it;
17805 }
17806
17807 bool RemoveMItem(ObjectGuid::LowType itemLowGuid)
17808 {
17809 return !!mMitems.erase(itemLowGuid);
17810 }
17811
17812 void PetSpellInitialize();
17813 void CharmSpellInitialize();
17816 void SendRemoveControlBar();
17817 [[nodiscard]] bool HasSpell(uint32 spell) const override;
17818 [[nodiscard]] bool HasActiveSpell(uint32 spell) const; // show in spellbook
17819 TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
17820 [[nodiscard]] bool IsSpellFitByClassAndRace(uint32 spell_id) const;
17821 bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
17822
17823 void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
17824 void SendInitialSpells();
17825 void SendLearnPacket(uint32 spellId, bool learn);
17826 bool addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary = false, bool learnFromSkill = false);
17827 bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill = false);
17828 void learnSpell(uint32 spellId, bool temporary = false, bool learnFromSkill = false);
17829 void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary);
17830 void resetSpells();
17831 void LearnCustomSpells();
17832 void LearnDefaultSkills();
17833 void LearnDefaultSkill(uint32 skillId, uint16 rank);
17835 void learnQuestRewardedSpells(Quest const* quest);
17836 void learnSpellHighRank(uint32 spellid);
17837 bool CheckSkillLearnedBySpell(uint32 spellId);
17838 void SetReputation(uint32 factionentry, float value);
17839 [[nodiscard]] uint32 GetReputation(uint32 factionentry) const;
17840 std::string const& GetGuildName();
17841 [[nodiscard]] uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
17842 void SetFreeTalentPoints(uint32 points);
17843 bool resetTalents(bool noResetCost = false);
17844 [[nodiscard]] uint32 resetTalentsCost() const;
17845 bool IsMaxLevel() const;
17846 void InitTalentForLevel();
17849 void SendTalentsInfoData(bool pet);
17850 void LearnTalent(uint32 talentId, uint32 talentRank, bool command = false);
17851 void LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank);
17852
17853 bool addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank);
17854 void _removeTalent(PlayerTalentMap::iterator& itr, uint8 specMask);
17855 void _removeTalent(uint32 spellId, uint8 specMask);
17856 void _removeTalentAurasAndSpells(uint32 spellId);
17857 void _addTalentAurasAndSpells(uint32 spellId);
17858 [[nodiscard]] bool HasTalent(uint32 spell_id, uint8 spec) const;
17859
17860 [[nodiscard]] uint32 CalculateTalentsPoints() const;
17861 void SetBonusTalentCount(uint32 count) { m_extraBonusTalentCount = count; };
17863 void AddBonusTalent(uint32 count) { m_extraBonusTalentCount += count; };
17864 void RemoveBonusTalent(uint32 count) { m_extraBonusTalentCount -= count; };
17865
17866 // Dual Spec
17867 void UpdateSpecCount(uint8 count);
17868 [[nodiscard]] uint8 GetActiveSpec() const { return m_activeSpec; }
17869 [[nodiscard]] uint8 GetActiveSpecMask() const { return (1 << m_activeSpec); }
17870 void SetActiveSpec(uint8 spec) { m_activeSpec = spec; }
17871 [[nodiscard]] uint8 GetSpecsCount() const { return m_specsCount; }
17872 void SetSpecsCount(uint8 count) { m_specsCount = count; }
17873 void ActivateSpec(uint8 spec);
17874 void LoadActions(PreparedQueryResult result);
17875 void GetTalentTreePoints(uint8 (&specPoints)[3]) const;
17876 [[nodiscard]] uint8 GetMostPointsTalentTree() const;
17877 bool HasTankSpec();
17878 bool HasMeleeSpec();
17879 bool HasCasterSpec();
17880 bool HasHealSpec();
17881 uint32 GetSpec(int8 spec = -1);
17882
17883 void InitGlyphsForLevel();
17884 void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
17885 [[nodiscard]] uint32 GetGlyphSlot(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
17886 void SetGlyph(uint8 slot, uint32 glyph, bool save)
17887 {
17888 m_Glyphs[m_activeSpec][slot] = glyph;
17890
17891 if (save)
17892 SetNeedToSaveGlyphs(true);
17893 }
17894 [[nodiscard]] uint32 GetGlyph(uint8 slot) const { return m_Glyphs[m_activeSpec][slot]; }
17895
17899
17900 [[nodiscard]] PlayerSpellMap const& GetSpellMap() const { return m_spells; }
17901 PlayerSpellMap& GetSpellMap() { return m_spells; }
17902
17903 [[nodiscard]] SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; }
17905
17906 SkillStatusMap const& GetSkillStatusMap() const { return mSkillStatus; }
17908
17909 void AddSpellMod(SpellModifier* mod, bool apply);
17910 bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr);
17911 bool HasSpellMod(SpellModifier* mod, Spell* spell);
17912 template <class T>
17913 void ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr, bool temporaryPet = false);
17914 void RemoveSpellMods(Spell* spell);
17915 void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr);
17916 void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr);
17917 void DropModCharge(SpellModifier* mod, Spell* spell);
17918 void SetSpellModTakingSpell(Spell* spell, bool apply);
17919
17920 [[nodiscard]] bool HasSpellCooldown(uint32 spell_id) const override;
17921 [[nodiscard]] bool HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const override;
17922 [[nodiscard]] uint32 GetSpellCooldownDelay(uint32 spell_id) const;
17923 void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = nullptr, bool infinityCooldown = false);
17924 void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false) override;
17925 void _AddSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false);
17926 void ModifySpellCooldown(uint32 spellId, int32 cooldown);
17927 void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = nullptr, bool setCooldown = true);
17928 void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override;
17929 void RemoveSpellCooldown(uint32 spell_id, bool update = false);
17930 void SendClearCooldown(uint32 spell_id, Unit* target);
17931
17933
17935 void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);
17938 void _SaveSpellCooldowns(CharacterDatabaseTransaction trans, bool logout);
17940 void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
17941 void UpdatePotionCooldown(Spell* spell = nullptr);
17942
17943 void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
17944 {
17945 m_resurrectGUID = guid;
17946 m_resurrectMap = mapId;
17947 m_resurrectX = X;
17948 m_resurrectY = Y;
17949 m_resurrectZ = Z;
17950 m_resurrectHealth = health;
17951 m_resurrectMana = mana;
17952 }
17953 void clearResurrectRequestData() { setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
17954 [[nodiscard]] bool isResurrectRequestedBy(ObjectGuid guid) const { return m_resurrectGUID && m_resurrectGUID == guid; }
17955 [[nodiscard]] bool isResurrectRequested() const { return m_resurrectGUID; }
17957
17958 [[nodiscard]] uint8 getCinematic() const
17959 {
17960 return m_cinematic;
17961 }
17962 void setCinematic(uint8 cine)
17963 {
17964 m_cinematic = cine;
17965 }
17966
17967 ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
17968 void removeActionButton(uint8 button);
17969 ActionButton const* GetActionButton(uint8 button);
17970 void SendInitialActionButtons() const { SendActionButtons(1); }
17971 void SendActionButtons(uint32 state) const;
17972 bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type);
17973
17975 void UpdatePvPState();
17976 void UpdateFFAPvPState(bool reset = true);
17977 void SetPvP(bool state)
17978 {
17979 Unit::SetPvP(state);
17980 if (!m_Controlled.empty())
17981 for (auto& itr : m_Controlled)
17982 itr->SetPvP(state);
17983 }
17984 void UpdatePvP(bool state, bool _override = false);
17985 void UpdateZone(uint32 newZone, uint32 newArea, bool force = false);
17986 void UpdateArea(uint32 newArea);
17987 void SetNeedZoneUpdate(bool needUpdate) { m_needZoneUpdate = needUpdate; }
17988
17989 void UpdateZoneDependentAuras(uint32 zone_id); // zones
17990 void UpdateAreaDependentAuras(uint32 area_id); // subzones
17991
17992 void UpdateAfkReport(time_t currTime);
17993 void UpdatePvPFlag(time_t currTime);
17994 void UpdateFFAPvPFlag(time_t currTime);
17995 void UpdateContestedPvP(uint32 currTime);
17996 void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;}
17997 void ResetContestedPvP()
17998 {
18002 }
18003
18005 std::unique_ptr<DuelInfo> duel;
18006 void UpdateDuelFlag(time_t currTime);
18007 void CheckDuelDistance(time_t currTime);
18008 void DuelComplete(DuelCompleteType type);
18009 void SendDuelCountdown(uint32 counter);
18010
18011 bool IsGroupVisibleFor(Player const* p) const;
18012 bool IsInSameGroupWith(Player const* p) const;
18013 bool IsInSameRaidWith(Player const* p) const { return p == this || (GetGroup() != nullptr && GetGroup() == p->GetGroup()); }
18014 void UninviteFromGroup();
18015 static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = nullptr);
18018
18019 void SetInGuild(uint32 GuildId)
18020 {
18022 // xinef: update global storage
18023 sCharacterCache->UpdateCharacterGuildId(GetGUID(), GetGuildId());
18024 }
18025 void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
18026 [[nodiscard]] uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
18027 void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
18028 [[nodiscard]] uint32 GetGuildId() const { return GetUInt32Value(PLAYER_GUILDID); }
18029 [[nodiscard]] Guild* GetGuild() const;
18031 static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type);
18032
18033 // Arena Team
18034 void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
18035 {
18036 SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
18038 }
18039 void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
18040 [[nodiscard]] uint32 GetArenaPersonalRating(uint8 slot) const;
18041 static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
18042 static void LeaveAllArenaTeams(ObjectGuid guid);
18043 [[nodiscard]] uint32 GetArenaTeamId(uint8 slot) const;
18044 void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
18046
18047 [[nodiscard]] Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
18048 [[nodiscard]] Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
18049 [[nodiscard]] Difficulty GetRaidDifficulty() const { return m_raidDifficulty; }
18050 [[nodiscard]] Difficulty GetStoredRaidDifficulty() const { return m_raidMapDifficulty; } // only for use in difficulty packet after exiting to raid map
18051 void SetDungeonDifficulty(Difficulty dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
18052 void SetRaidDifficulty(Difficulty raid_difficulty) { m_raidDifficulty = raid_difficulty; }
18054
18055 bool UpdateSkill(uint32 skill_id, uint32 step);
18056 bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step);
18057
18058 bool UpdateCraftSkill(uint32 spellid);
18059 bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1);
18060 bool UpdateFishingSkill();
18061
18062 [[nodiscard]] uint32 GetBaseDefenseSkillValue() const { return GetBaseSkillValue(SKILL_DEFENSE); }
18063 [[nodiscard]] uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const;
18064
18066
18069
18070 bool UpdateStats(Stats stat) override;
18071 bool UpdateAllStats() override;
18072 void ApplySpellPenetrationBonus(int32 amount, bool apply);
18073 void UpdateResistances(uint32 school) override;
18074 void UpdateArmor() override;
18075 void UpdateMaxHealth() override;
18076 void UpdateMaxPower(Powers power) override;
18077 void ApplyFeralAPBonus(int32 amount, bool apply);
18078 void UpdateAttackPowerAndDamage(bool ranged = false) override;
18080 void ApplySpellPowerBonus(int32 amount, bool apply);
18081 void ApplySpellDamageBonus(int32 amount, bool apply);
18082 void ApplySpellHealingBonus(int32 amount, bool apply);
18084 void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
18085 void UpdateRating(CombatRating cr);
18086 void UpdateAllRatings();
18087
18088 void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage, uint8 damageIndex) override;
18089
18091 inline void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);}
18093 void GetDodgeFromAgility(float& diminishing, float& nondiminishing);
18094 [[nodiscard]] float GetMissPercentageFromDefence() const;
18096 float OCTRegenHPPerSpirit();
18097 float OCTRegenMPPerSpirit();
18098 [[nodiscard]] float GetRatingMultiplier(CombatRating cr) const;
18099 [[nodiscard]] float GetRatingBonusValue(CombatRating cr) const;
18103 [[nodiscard]] int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }
18104
18105 [[nodiscard]] float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
18106 void UpdateBlockPercentage();
18109 void UpdateParryPercentage();
18110 void UpdateDodgePercentage();
18111 void UpdateMeleeHitChances();
18113 void UpdateSpellHitChances();
18114
18116 void UpdateSpellCritChance(uint32 school);
18117 void UpdateArmorPenetration(int32 amount);
18118 void UpdateExpertise(WeaponAttackType attType);
18119 void ApplyManaRegenBonus(int32 amount, bool apply);
18120 void ApplyHealthRegenBonus(int32 amount, bool apply);
18121 void UpdateManaRegen();
18122 void UpdateEnergyRegen();
18123 void UpdateRuneRegen(RuneType rune);
18124
18125 [[nodiscard]] ObjectGuid GetLootGUID() const { return m_lootGuid; }
18126 void SetLootGUID(ObjectGuid guid) { m_lootGuid = guid; }
18127
18128 void RemovedInsignia(Player* looterPlr);
18129
18130 [[nodiscard]] WorldSession* GetSession() const { return m_session; }
18131 void SetSession(WorldSession* sess) { m_session = sess; }
18132
18133 void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) override;
18134 void DestroyForPlayer(Player* target, bool onDeath = false) const override;
18135 void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate = 1.0f);
18136
18137 // notifiers
18143 void SendAutoRepeatCancel(Unit* target);
18144 void SendExplorationExperience(uint32 Area, uint32 Experience);
18145
18146 void SendDungeonDifficulty(bool IsInGroup);
18147 void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty = -1);
18148 static void ResetInstances(ObjectGuid guid, uint8 method, bool isRaid);
18149 void SendResetInstanceSuccess(uint32 MapId);
18150 void SendResetInstanceFailed(uint32 reason, uint32 MapId);
18151 void SendResetFailedNotify(uint32 mapid);
18152
18153 bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false) override;
18154 bool UpdatePosition(const Position& pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
18155
18156 void ProcessTerrainStatusUpdate() override;
18157
18158 void SendMessageToSet(WorldPacket const* data, bool self) const override;
18159 void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self) const override;
18160 void SendMessageToSet(WorldPacket const* data, Player const* skipped_rcvr) const override;
18161 void SendTeleportAckPacket();
18162
18163 [[nodiscard]] Corpse* GetCorpse() const;
18164 void SpawnCorpseBones(bool triggerSave = true);
18166 void RemoveCorpse();
18167 void KillPlayer();
18168 static void OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans);
18169 [[nodiscard]] bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
18170 [[nodiscard]] WorldLocation GetCorpseLocation() const { return _corpseLocation; }
18172 void ResurrectPlayer(float restore_percent, bool applySickness = false);
18173 void BuildPlayerRepop();
18174 void RepopAtGraveyard();
18175
18176 void SendDurabilityLoss();
18177 void DurabilityLossAll(double percent, bool inventory);
18178 void DurabilityLoss(Item* item, double percent);
18179 void DurabilityPointsLossAll(int32 points, bool inventory);
18180 void DurabilityPointsLoss(Item* item, int32 points);
18182 uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank);
18183 uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank);
18184
18185 void UpdateMirrorTimers();
18186 void StopMirrorTimers()
18187 {
18191 }
18192 bool IsMirrorTimerActive(MirrorTimerType type) { return m_MirrorTimer[type] == getMaxTimer(type); }
18193
18194 void SetMovement(PlayerMovementType pType);
18195
18196 bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone);
18197
18198 void JoinedChannel(Channel* c);
18199 void LeftChannel(Channel* c);
18200 void CleanupChannels();
18201 void ClearChannelWatch();
18202 void UpdateLFGChannel();
18203 void UpdateLocalChannels(uint32 newZone);
18204
18205 void UpdateDefense();
18206 void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item = nullptr);
18207 void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item = nullptr);
18208
18209 void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal);
18210 [[nodiscard]] uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
18211 [[nodiscard]] uint16 GetPureMaxSkillValue(uint32 skill) const; // max
18212 [[nodiscard]] uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
18213 [[nodiscard]] uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
18214 [[nodiscard]] uint16 GetPureSkillValue(uint32 skill) const; // skill value
18215 [[nodiscard]] int16 GetSkillPermBonusValue(uint32 skill) const;
18216 [[nodiscard]] int16 GetSkillTempBonusValue(uint32 skill) const;
18217 [[nodiscard]] uint16 GetSkillStep(uint16 skill) const; // 0...6
18218 [[nodiscard]] bool HasSkill(uint32 skill) const;
18219 void learnSkillRewardedSpells(uint32 id, uint32 value);
18220
18222 [[nodiscard]] bool IsBeingTeleported() const { return mSemaphoreTeleport_Near != 0 || mSemaphoreTeleport_Far != 0; }
18223 [[nodiscard]] bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near != 0; }
18224 [[nodiscard]] bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far != 0; }
18225 void SetSemaphoreTeleportNear(time_t tm) { mSemaphoreTeleport_Near = tm; }
18226 void SetSemaphoreTeleportFar(time_t tm) { mSemaphoreTeleport_Far = tm; }
18227 [[nodiscard]] time_t GetSemaphoreTeleportNear() const { return mSemaphoreTeleport_Near; }
18228 [[nodiscard]] time_t GetSemaphoreTeleportFar() const { return mSemaphoreTeleport_Far; }
18230 [[nodiscard]] uint32 GetDelayedOperations() const { return m_DelayedOperations; }
18231 void ScheduleDelayedOperation(uint32 operation)
18232 {
18233 if (operation < DELAYED_END)
18234 m_DelayedOperations |= operation;
18235 }
18236
18238
18239 static TeamId TeamIdForRace(uint8 race);
18240 [[nodiscard]] TeamId GetTeamId(bool original = false) const { return original ? TeamIdForRace(getRace(true)) : m_team; };
18241 void SetFactionForRace(uint8 race);
18242 void setTeamId(TeamId teamid) { m_team = teamid; };
18243
18244 void InitDisplayIds();
18245
18246 bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
18247 bool IsAtLootRewardDistance(WorldObject const* pRewardSource) const;
18248 bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const;
18249 void RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround);
18250 void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
18251 bool isHonorOrXPTarget(Unit* victim) const;
18252
18253 bool GetsRecruitAFriendBonus(bool forXP);
18255 void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
18256
18258 [[nodiscard]] ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
18259 [[nodiscard]] ReputationRank GetReputationRank(uint32 faction_id) const;
18260 void RewardReputation(Unit* victim);
18261 void RewardReputation(Quest const* quest);
18262
18263 float CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus = false);
18264
18265 void UpdateSkillsForLevel();
18266 void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
18267 void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
18268
18277 void RewardExtraBonusTalentPoints(uint32 bonusTalentPoints);
18278
18279 /*********************************************************/
18280 /*** PVP SYSTEM ***/
18281 /*********************************************************/
18282 void UpdateHonorFields();
18283 bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool awardXP = true);
18284 [[nodiscard]] uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); }
18285 [[nodiscard]] uint32 GetArenaPoints() const { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); }
18288 [[nodiscard]] uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const;
18289 void SetHonorPoints(uint32 value);
18290 void SetArenaPoints(uint32 value);
18291
18292 // duel health and mana reset methods
18297
18298 //End of PvP System
18299
18300 [[nodiscard]] inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
18301
18302 void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
18303 [[nodiscard]] uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); }
18304 [[nodiscard]] int32 GetFakeDrunkValue() const { return GetInt32Value(PLAYER_FAKE_INEBRIATION); }
18307
18308 [[nodiscard]] uint32 GetDeathTimer() const { return m_deathTimer; }
18309 [[nodiscard]] uint32 GetCorpseReclaimDelay(bool pvp) const;
18311 int32 CalculateCorpseReclaimDelay(bool load = false);
18312 void SendCorpseReclaimDelay(uint32 delay);
18313
18314 [[nodiscard]] uint32 GetShieldBlockValue() const override; // overwrite Unit version (virtual)
18315 [[nodiscard]] bool CanParry() const { return m_canParry; }
18316 void SetCanParry(bool value);
18317 [[nodiscard]] bool CanBlock() const { return m_canBlock; }
18318 void SetCanBlock(bool value);
18319 [[nodiscard]] bool CanTitanGrip() const { return m_canTitanGrip; }
18320 void SetCanTitanGrip(bool value);
18321 [[nodiscard]] bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
18322
18323 void SetRegularAttackTime();
18324 void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
18325 void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply);
18326 [[nodiscard]] float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
18327 [[nodiscard]] float GetTotalBaseModValue(BaseModGroup modGroup) const;
18328 [[nodiscard]] float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }
18329 void _ApplyAllStatBonuses();
18330 void _RemoveAllStatBonuses();
18331
18332 void ResetAllPowers();
18333
18334 SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK, uint8 damageIndex = 0) const override;
18335
18336 void _ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackType, bool apply);
18337 void _ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply);
18338 void _ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply);
18339
18340 void _ApplyItemMods(Item* item, uint8 slot, bool apply);
18341 void _RemoveAllItemMods();
18342 void _ApplyAllItemMods();
18343 void _ApplyAllLevelScaleItemMods(bool apply);
18344 void _ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale = false);
18345 void _ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply);
18346 void _ApplyAmmoBonuses();
18347 bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
18348 void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
18349 void CorrectMetaGemEnchants(uint8 slot, bool apply);
18350 void InitDataForForm(bool reapplyMods = false);
18351
18352 void ApplyItemEquipSpell(Item* item, bool apply, bool form_change = false);
18353 void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change = false);
18355 void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
18356 void CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex);
18357 void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto);
18358
18359 void SendEquipmentSetList();
18360 void SetEquipmentSet(uint32 index, EquipmentSet eqset);
18361 void DeleteEquipmentSet(uint64 setGuid);
18362
18363 void SendInitWorldStates(uint32 zoneId, uint32 areaId);
18364 void SendUpdateWorldState(uint32 variable, uint32 value) const;
18365 void SendDirectMessage(WorldPacket const* data) const;
18368
18369 void GetAurasForTarget(Unit* target, bool force = false);
18370
18372 std::vector<ItemSetEffect*> ItemSetEff;
18373
18374 void SendLoot(ObjectGuid guid, LootType loot_type);
18375 void SendLootError(ObjectGuid guid, LootError error);
18376 void SendLootRelease(ObjectGuid guid);
18377 void SendNotifyLootItemRemoved(uint8 lootSlot);
18379
18380 /*********************************************************/
18381 /*** BATTLEGROUND SYSTEM ***/
18382 /*********************************************************/
18383
18384 [[nodiscard]] bool InBattleground() const { return m_bgData.bgInstanceID != 0; }
18385 [[nodiscard]] bool InArena() const;
18386 [[nodiscard]] uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; }
18387 [[nodiscard]] BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; }
18388 [[nodiscard]] uint32 GetCurrentBattlegroundQueueSlot() const { return m_bgData.bgQueueSlot; }
18389 [[nodiscard]] bool IsInvitedForBattlegroundInstance() const { return m_bgData.isInvited; }
18390 [[nodiscard]] bool IsCurrentBattlegroundRandom() const { return m_bgData.bgIsRandom; }
18391 BGData& GetBGData() { return m_bgData; }
18392 void SetBGData(BGData& bgdata) { m_bgData = bgdata; }
18393 [[nodiscard]] Battleground* GetBattleground(bool create = false) const;
18394
18395 [[nodiscard]] bool InBattlegroundQueue(bool ignoreArena = false) const;
18396 [[nodiscard]] bool IsDeserter() const { return HasAura(26013); }
18397
18399 [[nodiscard]] uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const;
18400 [[nodiscard]] bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
18401 [[nodiscard]] bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
18402
18403 void SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId);
18405 bool HasFreeBattlegroundQueueId() const;
18408 bool IsInvitedForBattlegroundInstance(uint32 instanceId) const;
18409
18410 [[nodiscard]] TeamId GetBgTeamId() const { return m_bgData.bgTeamId != TEAM_NEUTRAL ? m_bgData.bgTeamId : GetTeamId(); }
18411
18412 void LeaveBattleground(Battleground* bg = nullptr);
18413 [[nodiscard]] bool CanJoinToBattleground() const;
18415 void ReportedAfkBy(Player* reporter);
18416 void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
18417
18418 [[nodiscard]] bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
18419 bool CanUseBattlegroundObject(GameObject* gameobject) const;
18420 [[nodiscard]] bool isTotalImmune() const;
18421 [[nodiscard]] bool CanCaptureTowerPoint() const;
18422
18423 bool GetRandomWinner() { return m_IsBGRandomWinner; }
18424 void SetRandomWinner(bool isWinner);
18425
18426 /*********************************************************/
18427 /*** OUTDOOR PVP SYSTEM ***/
18428 /*********************************************************/
18429
18430 [[nodiscard]] OutdoorPvP* GetOutdoorPvP() const;
18431 // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise
18432 bool IsOutdoorPvPActive();
18433
18434 /*********************************************************/
18435 /*** ENVIROMENTAL SYSTEM ***/
18436 /*********************************************************/
18437
18440
18441 /*********************************************************/
18442 /*** FLOOD FILTER SYSTEM ***/
18443 /*********************************************************/
18444
18445 struct ChatFloodThrottle
18446 {
18447 enum Index
18448 {
18449 REGULAR = 0,
18450 ADDON = 1,
18451 MAX
18452 };
18453
18454 time_t Time = 0;
18455 uint32 Count = 0;
18456 };
18457
18459 [[nodiscard]] bool CanSpeak() const;
18460
18461 /*********************************************************/
18462 /*** VARIOUS SYSTEMS ***/
18463 /*********************************************************/
18464 void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode);
18467 std::set<Unit*> m_isInSharedVisionOf;
18468 void SetFallInformation(uint32 time, float z)
18469 {
18470 m_lastFallTime = time;
18471 m_lastFallZ = z;
18472 }
18473 void HandleFall(MovementInfo const& movementInfo);
18474
18475 [[nodiscard]] bool canFlyInZone(uint32 mapid, uint32 zone, SpellInfo const* bySpell);
18476
18477 void SetClientControl(Unit* target, bool allowMove, bool packetOnly = false);
18478
18479 void SetMover(Unit* target);
18480
18481 void SetSeer(WorldObject* target) { m_seer = target; }
18482 void SetViewpoint(WorldObject* target, bool apply);
18483 [[nodiscard]] WorldObject* GetViewpoint() const;
18484 void StopCastingCharm(Aura* except = nullptr);
18485 void StopCastingBindSight(Aura* except = nullptr);
18486
18487 [[nodiscard]] uint32 GetSaveTimer() const { return m_nextSave; }
18488 void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
18489
18490 // Recall position
18492 float m_recallX;
18493 float m_recallY;
18494 float m_recallZ;
18495 float m_recallO;
18496 void SaveRecallPosition();
18497
18498 void SetHomebind(WorldLocation const& loc, uint32 areaId);
18499
18500 // Homebind coordinates
18503 float m_homebindX;
18504 float m_homebindY;
18505 float m_homebindZ;
18506
18507 [[nodiscard]] WorldLocation GetStartPosition() const;
18508
18509 [[nodiscard]] WorldLocation const& GetEntryPoint() const { return m_entryPointData.joinPos; }
18510 void SetEntryPoint();
18511
18512 // currently visible objects at player client
18513 std::vector<Unit*> m_newVisible; // pussywizard
18514
18515 [[nodiscard]] bool HaveAtClient(WorldObject const* u) const;
18516 [[nodiscard]] bool HaveAtClient(ObjectGuid guid) const;
18517
18518 [[nodiscard]] bool IsNeverVisible() const override;
18519
18520 bool IsVisibleGloballyFor(Player const* player) const;
18521
18522 void GetInitialVisiblePackets(Unit* target);
18523 void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false) override;
18524 void UpdateVisibilityForPlayer(bool mapChange = false);
18525 void UpdateVisibilityOf(WorldObject* target);
18527
18528 template<class T>
18529 void UpdateVisibilityOf(T* target, UpdateData& data, std::vector<Unit*>& visibleNow);
18530
18532
18533 [[nodiscard]] bool HasAtLoginFlag(AtLoginFlags f) const { return m_atLoginFlags & f; }
18535 void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
18536
18537 bool IsUsingLfg();
18538 bool inRandomLfgDungeon();
18539
18540 typedef std::set<uint32> DFQuestsDoneList;
18542
18543 // Temporarily removed pet cache
18548 [[nodiscard]] bool IsPetNeedBeTemporaryUnsummoned() const { return GetSession()->PlayerLogout() || !IsInWorld() || !IsAlive() || IsMounted()/*+in flight*/ || GetVehicle() || IsBeingTeleported(); }
18549 bool CanResummonPet(uint32 spellid);
18550
18551 void SendCinematicStart(uint32 CinematicSequenceId) const;
18552 void SendMovieStart(uint32 MovieId);
18553
18554 uint32 DoRandomRoll(uint32 minimum, uint32 maximum);
18555
18556 [[nodiscard]] uint16 GetMaxSkillValueForLevel() const;
18557 bool IsFFAPvP();
18558 bool IsPvP();
18559
18560 /*********************************************************/
18561 /*** INSTANCE SYSTEM ***/
18562 /*********************************************************/
18563
18564 void UpdateHomebindTime(uint32 time);
18565
18567 bool m_InstanceValid;
18568 void BindToInstance();
18569 void SetPendingBind(uint32 instanceId, uint32 bindTimer) { _pendingBindId = instanceId; _pendingBindTimer = bindTimer; }
18570 [[nodiscard]] bool HasPendingBind() const { return _pendingBindId > 0; }
18571 [[nodiscard]] uint32 GetPendingBind() const { return _pendingBindId; }
18572 void SendRaidInfo();
18573 void SendSavedInstances();
18574 void PrettyPrintRequirementsQuestList(const std::vector<const ProgressionRequirement*>& missingQuests) const;
18575 void PrettyPrintRequirementsAchievementsList(const std::vector<const ProgressionRequirement*>& missingAchievements) const;
18576 void PrettyPrintRequirementsItemsList(const std::vector<const ProgressionRequirement*>& missingItems) const;
18577 bool Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map, bool report = false);
18579 [[nodiscard]] bool CheckInstanceCount(uint32 instanceId) const;
18580
18581 void AddInstanceEnterTime(uint32 instanceId, time_t enterTime)
18582 {
18583 if (_instanceResetTimes.find(instanceId) == _instanceResetTimes.end())
18584 _instanceResetTimes.insert(InstanceTimeMap::value_type(instanceId, enterTime + HOUR));
18585 }
18586
18587 // last used pet number (for BG's)
18588 [[nodiscard]] uint32 GetLastPetNumber() const { return m_lastpetnumber; }
18589 void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; }
18590 [[nodiscard]] uint32 GetLastPetSpell() const { return m_oldpetspell; }
18591 void SetLastPetSpell(uint32 petspell) { m_oldpetspell = petspell; }
18592
18593 /*********************************************************/
18594 /*** GROUP SYSTEM ***/
18595 /*********************************************************/
18596
18597 Group* GetGroupInvite() { return m_groupInvite; }
18598 void SetGroupInvite(Group* group) { m_groupInvite = group; }
18599 Group* GetGroup() { return m_group.getTarget(); }
18600 [[nodiscard]] const Group* GetGroup() const { return (const Group*)m_group.getTarget(); }
18601 GroupReference& GetGroupRef() { return m_group; }
18602 void SetGroup(Group* group, int8 subgroup = -1);
18603 [[nodiscard]] uint8 GetSubGroup() const { return m_group.getSubGroup(); }
18604 [[nodiscard]] uint32 GetGroupUpdateFlag() const { return m_groupUpdateMask; }
18605 void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
18606 [[nodiscard]] uint64 GetAuraUpdateMaskForRaid() const { return m_auraRaidUpdateMask; }
18607 void SetAuraUpdateMaskForRaid(uint8 slot) { m_auraRaidUpdateMask |= (uint64(1) << slot); }
18608 Player* GetNextRandomRaidMember(float radius);
18609 [[nodiscard]] PartyResult CanUninviteFromGroup(ObjectGuid targetPlayerGUID = ObjectGuid::Empty) const;
18610
18611 // Battleground Group System
18612 void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
18616 [[nodiscard]] uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
18617 void SetOriginalGroup(Group* group, int8 subgroup = -1);
18618
18619 void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
18620 [[nodiscard]] bool GetPassOnGroupLoot() const { return m_bPassOnGroupLoot; }
18621
18622 MapReference& GetMapRef() { return m_mapRef; }
18623
18624 // Set map to player and add reference
18625 void SetMap(Map* map) override;
18626 void ResetMap() override;
18627
18628 bool CanTeleport() { return m_canTeleport; }
18629 void SetCanTeleport(bool value) { m_canTeleport = value; }
18630 bool CanKnockback() { return m_canKnockback; }
18631 void SetCanKnockback(bool value) { m_canKnockback = value; }
18632
18633 bool isAllowedToLoot(Creature const* creature);
18634
18635 [[nodiscard]] DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
18636 [[nodiscard]] uint8 GetRunesState() const { return m_runes->runeState; }
18637 [[nodiscard]] RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); }
18638 [[nodiscard]] RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); }
18639 [[nodiscard]] uint32 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
18640 [[nodiscard]] uint32 GetGracePeriod(uint8 index) const { return m_runes->runes[index].GracePeriod; }
18641 uint32 GetRuneBaseCooldown(uint8 index, bool skipGrace);
18642 [[nodiscard]] bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const;
18644 void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
18645 void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
18646 void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
18647 void SetRuneCooldown(uint8 index, uint32 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0)); }
18648 void SetGracePeriod(uint8 index, uint32 period) { m_runes->runes[index].GracePeriod = period; }
18649 void SetRuneConvertAura(uint8 index, AuraEffect const* aura) { m_runes->runes[index].ConvertAura = aura; }
18650 void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const* aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
18651 void RemoveRunesByAuraEffect(AuraEffect const* aura);
18652 void RestoreBaseRune(uint8 index);
18653 void ConvertRune(uint8 index, RuneType newType);
18654 void ResyncRunes(uint8 count);
18655 void AddRunePower(uint8 index);
18656 void InitRunes();
18657
18658 void SendRespondInspectAchievements(Player* player) const;
18659 [[nodiscard]] bool HasAchieved(uint32 achievementId) const;
18660 void ResetAchievements();
18662 void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false);
18663 void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr);
18664 void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
18666 void CompletedAchievement(AchievementEntry const* entry);
18667 [[nodiscard]] AchievementMgr* GetAchievementMgr() const { return m_achievementMgr; }
18668
18669 void SetCreationTime(Seconds creationTime) { m_creationTime = creationTime; }
18670 [[nodiscard]] Seconds GetCreationTime() const { return m_creationTime; }
18671
18672 [[nodiscard]] bool HasTitle(uint32 bitIndex) const;
18673 bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->bit_index); }
18674 void SetTitle(CharTitlesEntry const* title, bool lost = false);
18675 void SetCurrentTitle(CharTitlesEntry const* title, bool clear = false) { SetUInt32Value(PLAYER_CHOSEN_TITLE, clear ? 0 : title->bit_index); };
18676
18677 //bool isActiveObject() const { return true; }
18678 bool CanSeeSpellClickOn(Creature const* creature) const;
18679 [[nodiscard]] bool CanSeeVendor(Creature const* creature) const;
18680
18681 [[nodiscard]] uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
18682 void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
18684
18685 float GetAverageItemLevel();
18688
18689 void ClearWhisperWhiteList() { WhisperList.clear(); }
18690 void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
18692 void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
18693
18694 bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override;
18695 bool SetCanFly(bool apply, bool packetOnly = false) override;
18696 bool SetWaterWalking(bool apply, bool packetOnly = false) override;
18697 bool SetFeatherFall(bool apply, bool packetOnly = false) override;
18698 bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override;
18699
18700 [[nodiscard]] bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
18701 [[nodiscard]] bool CanEnterWater() const override { return true; }
18702
18703 // saving
18705 // arena spectator
18706 [[nodiscard]] bool IsSpectator() const { return m_ExtraFlags & PLAYER_EXTRA_SPECTATOR_ON; }
18707 void SetIsSpectator(bool on);
18708 [[nodiscard]] bool NeedSendSpectatorData() const;
18709 void SetPendingSpectatorForBG(uint32 bgInstanceId) { m_pendingSpectatorForBG = bgInstanceId; }
18710 [[nodiscard]] bool HasPendingSpectatorForBG(uint32 bgInstanceId) const { return m_pendingSpectatorForBG == bgInstanceId; }
18720
18721 // Dancing Rune weapon
18722 void setRuneWeaponGUID(ObjectGuid guid) { m_drwGUID = guid; };
18725
18726 [[nodiscard]] bool CanSeeDKPet() const { return m_ExtraFlags & PLAYER_EXTRA_SHOW_DK_PET; }
18727 void SetShowDKPet(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_SHOW_DK_PET; else m_ExtraFlags &= ~PLAYER_EXTRA_SHOW_DK_PET; };
18728 void PrepareCharmAISpells();
18730
18731 bool NeedToSaveGlyphs() { return m_NeedToSaveGlyphs; }
18732 void SetNeedToSaveGlyphs(bool val) { m_NeedToSaveGlyphs = val; }
18733
18735 void SetMountBlockId(uint32 mount) { m_MountBlockId = mount; }
18736
18737 [[nodiscard]] float GetRealParry() const { return m_realParry; }
18738 [[nodiscard]] float GetRealDodge() const { return m_realDodge; }
18739 // mt maps
18740 [[nodiscard]] const PlayerTalentMap& GetTalentMap() const { return m_talents; }
18741 [[nodiscard]] uint32 GetNextSave() const { return m_nextSave; }
18742 [[nodiscard]] SpellModList const& GetSpellModList(uint32 type) const { return m_spellMods[type]; }
18743
18746
18747 static std::unordered_map<int, bgZoneRef> bgZoneIdToFillWorldStates; // zoneId -> FillInitialWorldStates
18748
18749 void SetFarSightDistance(float radius);
18750 void ResetFarSightDistance();
18751 [[nodiscard]] Optional<float> GetFarSightDistance() const;
18752
18753 float GetSightRange(WorldObject const* target = nullptr) const override;
18754
18755 std::string GetPlayerName();
18756
18757 // Settings
18758 [[nodiscard]] PlayerSetting GetPlayerSetting(std::string const& source, uint8 index);
18759 void UpdatePlayerSetting(std::string const& source, uint8 index, uint32 value);
18760
18761 void SendSystemMessage(std::string_view msg, bool escapeCharacters = false);
18762
18763 std::string GetDebugInfo() const override;
18764
18765 /*********************************************************/
18766 /*** SPELL QUEUE SYSTEM ***/
18767 /*********************************************************/
18768protected:
18770 void ProcessSpellQueue();
18771
18772public:
18773 std::deque<PendingSpellCastRequest> SpellQueue;
18774 const PendingSpellCastRequest* GetCastRequest(uint32 category) const;
18775 bool CanExecutePendingSpellCastRequest(SpellInfo const* spellInfo);
18776 void ExecuteOrCancelSpellCastRequest(PendingSpellCastRequest* castRequest, bool isCancel = false);
18777 bool CanRequestSpellCast(SpellInfo const* spellInfo);
18778
18779protected:
18780 // Gamemaster whisper whitelist
18782
18783 // Performance Varibales
18784 bool m_NeedToSaveGlyphs;
18785 // Mount block bug
18787 // Real stats
18788 float m_realDodge;
18789 float m_realParry;
18790
18792
18798
18799 /*********************************************************/
18800 /*** BATTLEGROUND SYSTEM ***/
18801 /*********************************************************/
18802
18803 struct BgBattlegroundQueueID_Rec
18804 {
18807 };
18808
18809 std::array<BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES> _BgBattlegroundQueueID;
18811 bool m_IsBGRandomWinner;
18812
18813 /*********************************************************/
18814 /*** ENTRY POINT ***/
18815 /*********************************************************/
18816
18818
18819 /*********************************************************/
18820 /*** QUEST SYSTEM ***/
18821 /*********************************************************/
18822
18823 //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
18824 typedef std::set<uint32> QuestSet;
18825 typedef std::set<uint32> SeasonalQuestSet;
18826 typedef std::unordered_map<uint32, SeasonalQuestSet> SeasonalEventQuestMap;
18831
18834
18835 /*********************************************************/
18836 /*** LOAD SYSTEM ***/
18837 /*********************************************************/
18838
18839 void _LoadActions(PreparedQueryResult result);
18840 void _LoadAuras(PreparedQueryResult result, uint32 timediff);
18841 void _LoadGlyphAuras();
18842 void _LoadInventory(PreparedQueryResult result, uint32 timeDiff);
18843 void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult);
18844 static Item* _LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint32 mailId, Mail* mail, Field* fields);
18852 void _LoadGroup();
18853 void _LoadSkills(PreparedQueryResult result);
18854 void _LoadSpells(PreparedQueryResult result);
18858 void _LoadArenaTeamInfo();
18861 void _LoadGlyphs(PreparedQueryResult result);
18862 void _LoadTalents(PreparedQueryResult result);
18866 void _LoadPetStable(uint8 petStableSlots, PreparedQueryResult result);
18867
18868 /*********************************************************/
18869 /*** SAVE SYSTEM ***/
18870 /*********************************************************/
18871
18873 void _SaveAuras(CharacterDatabaseTransaction trans, bool logout);
18887 void _SaveCharacter(bool create, CharacterDatabaseTransaction trans);
18890
18891 /*********************************************************/
18892 /*** ENVIRONMENTAL SYSTEM ***/
18893 /*********************************************************/
18894 void HandleSobering();
18895 void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
18897 void HandleDrowning(uint32 time_diff);
18899
18900 /*********************************************************/
18901 /*** HONOR SYSTEM ***/
18902 /*********************************************************/
18903 time_t m_lastHonorUpdateTime;
18904
18905 void outDebugValues() const;
18907
18908 TeamId m_team;
18909 uint32 m_nextSave; // pussywizard
18910 uint16 m_additionalSaveTimer; // pussywizard
18911 uint8 m_additionalSaveMask; // pussywizard
18912 uint16 m_hostileReferenceCheckTimer; // pussywizard
18913 std::array<ChatFloodThrottle, ChatFloodThrottle::MAX> m_chatFloodData;
18917
18919
18922
18923 std::vector<Item*> m_itemUpdateQueue;
18925
18927
18930
18934
18936
18939
18943 uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
18944
18946
18949
18951
18953
18963
18965 //uint32 m_pad;
18966 // Spell* m_spellModTakingSpell; // Spell for which charges are dropped in spell::finish
18967
18971 std::mutex m_soulboundTradableLock;
18972
18977
18979
18980 typedef std::list<Channel*> JoinedChannelsList;
18982
18984
18986
18991 time_t m_lastDailyQuestTime;
18992
18995
18999
19001 time_t m_deathExpireTime;
19002
19005 bool m_canParry;
19006 bool m_canBlock;
19007 bool m_canTitanGrip;
19009 float m_ammoDPS;
19010
19011 float m_Expertise;
19012 float m_OffhandExpertise;
19013
19015 time_t _restTime;
19017 float _restBonus;
19021 time_t m_resetTalentsTime;
19025
19026 // Social
19028
19029 // Groups
19035 bool m_bPassOnGroupLoot;
19036
19037 // last used pet number (for BG's)
19039
19040 // Player summoning
19041 time_t m_summon_expire;
19043 float m_summon_x;
19044 float m_summon_y;
19045 float m_summon_z;
19047
19049 Runes* m_runes;
19051
19052 bool CanAlwaysSee(WorldObject const* obj) const override;
19053
19054 bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
19055
19057
19058 bool m_needZoneUpdate;
19059
19060private:
19061 // internal common parts for CanStore/StoreItem functions
19062 InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
19063 InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
19064 InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
19065 Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
19066 Item* _LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field* fields);
19067
19069
19072 void SendRefundInfo(Item* item);
19073 void RefundItem(Item* item);
19074
19075 // know currencies are not removed at any point (0 displayed)
19076 void AddKnownCurrency(uint32 itemId);
19077
19078 void AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questStatusData);
19079
19080 [[nodiscard]] bool MustDelayTeleport() const { return m_bMustDelayTeleport; } // pussywizard: must delay teleports during player update to the very end
19081 void SetMustDelayTeleport(bool setting) { m_bMustDelayTeleport = setting; }
19082 [[nodiscard]] bool HasDelayedTeleport() const { return m_bHasDelayedTeleport; }
19083 void SetHasDelayedTeleport(bool setting) { m_bHasDelayedTeleport = setting; }
19084
19086
19087 void UpdateCharmedAI();
19088
19090 float m_lastFallZ;
19091
19095 bool m_isInWater;
19096
19097 // Current teleport data
19102
19106 bool m_canTeleport;
19107 bool m_canKnockback;
19108
19109 std::unique_ptr<PetStable> m_petStable;
19110
19111 // Temporary removed pet cache
19114
19117
19119
19121
19125
19127
19128 // duel health and mana reset attributes
19131
19133
19135
19137
19139
19140 bool _wasOutdoor;
19141
19143
19145};
19146
19147void AddItemsSetItem(Player* player, Item* item);
19148void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
19149
19150#endif
ArenaTeamInfoType
Definition ArenaTeam.h:73
AchievementCriteriaTimedTypes
Definition DBCEnums.h:109
AchievementCriteriaCondition
Definition DBCEnums.h:86
AchievementCriteriaTypes
Definition DBCEnums.h:121
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:27
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
ItemClass
Definition ItemTemplate.h:290
BuyResult
Definition Item.h:140
SellResult
Definition Item.h:154
LootError
Definition LootMgr.h:95
LootType
Definition LootMgr.h:77
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:254
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:253
std::map< std::string, PlayerSettingVector > PlayerSettingMap
Definition PlayerSettings.h:52
PlayerCharmedAISpells
Definition Player.h:921
@ SPELL_HIGH_DAMAGE2
Definition Player.h:927
QuestSound
Definition Player.h:250
std::deque< Mail * > PlayerMails
Definition Player.h:67
std::list< PlayerCreateInfoSkill > PlayerCreateInfoSkills
Definition Player.h:338
TrainerSpellState
Definition Player.h:213
ReferAFriendError
Definition Player.h:972
@ ERR_REFER_A_FRIEND_TARGET_TOO_HIGH
Definition Player.h:975
@ ERR_REFER_A_FRIEND_SUMMON_OFFLINE_S
Definition Player.h:986
@ ERR_REFER_A_FRIEND_DIFFERENT_FACTION
Definition Player.h:978
@ ERR_REFER_A_FRIEND_NONE
Definition Player.h:973
@ ERR_REFER_A_FRIEND_NO_TARGET
Definition Player.h:981
@ ERR_REFER_A_FRIEND_NOT_NOW
Definition Player.h:979
@ ERR_REFER_A_FRIEND_INSUF_EXPAN_LVL
Definition Player.h:985
@ ERR_REFER_A_FRIEND_INSUFFICIENT_GRANTABLE_LEVELS
Definition Player.h:976
@ ERR_REFER_A_FRIEND_NOT_REFERRED_BY
Definition Player.h:974
@ ERR_REFER_A_FRIEND_TOO_FAR
Definition Player.h:977
@ ERR_REFER_A_FRIEND_SUMMON_LEVEL_MAX_I
Definition Player.h:983
@ ERR_REFER_A_FRIEND_NOT_IN_GROUP
Definition Player.h:982
@ ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I
Definition Player.h:980
@ ERR_REFER_A_FRIEND_SUMMON_COOLDOWN
Definition Player.h:984
TeleportToOptions
Definition Player.h:827
EnviromentalDamage
Type of environmental damages.
Definition Player.h:840
@ DAMAGE_FIRE
Definition Player.h:846
std::list< SpellModifier * > SpellModList
Definition Player.h:195
@ RUNE_UNHOLY
Definition Player.h:416
@ RUNE_DEATH
Definition Player.h:418
@ RUNE_FROST
Definition Player.h:417
DuelState
Definition Player.h:375
PlayerFieldByte2Flags
Definition Player.h:572
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:574
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:575
@ PLAYER_FIELD_BYTE2_NONE
Definition Player.h:573
QuestSlotStateMask
Definition Player.h:638
@ QUEST_STATE_NONE
Definition Player.h:639
PlayerFieldByteFlags
Definition Player.h:564
@ PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW
Definition Player.h:567
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:565
TransferAbortReason
Definition Player.h:789
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition Player.h:794
@ TRANSFER_ABORT_NOT_FOUND1
Definition Player.h:801
@ TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES
Definition Player.h:799
@ TRANSFER_ABORT_MAX_PLAYERS
Definition Player.h:792
@ TRANSFER_ABORT_NOT_FOUND3
Definition Player.h:803
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition Player.h:795
@ TRANSFER_ABORT_NONE
Definition Player.h:790
@ TRANSFER_ABORT_NOT_FOUND
Definition Player.h:793
@ TRANSFER_ABORT_NEED_GROUP
Definition Player.h:800
@ TRANSFER_ABORT_NOT_FOUND2
Definition Player.h:802
@ TRANSFER_ABORT_REALM_ONLY
Definition Player.h:804
@ TRANSFER_ABORT_ERROR
Definition Player.h:791
PlayerExtraFlags
Definition Player.h:589
KeyRingSlots
Definition Player.h:736
InventoryPackSlots
Definition Player.h:711
@ PLAYER_FLAGS_UNK28
Definition Player.h:508
@ PLAYER_FLAGS_PLAYED_LONG_TIME
Definition Player.h:492
@ PLAYER_FLAGS_UNK27
Definition Player.h:507
@ PLAYER_FLAGS_UNK26
Definition Player.h:506
@ PLAYER_FLAGS_UNK16
Definition Player.h:496
@ PLAYER_FLAGS_UNK20
Definition Player.h:500
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition Player.h:497
@ PLAYER_FLAGS_UNK24
Definition Player.h:504
@ PLAYER_FLAGS_UNK6
Definition Player.h:486
@ PLAYER_FLAGS_UNK31
Definition Player.h:511
@ PLAYER_FLAGS_UNK21
Definition Player.h:501
@ PLAYER_FLAGS_UNK29
Definition Player.h:509
@ PLAYER_FLAGS_UNK7
Definition Player.h:487
@ PLAYER_FLAGS_UBER
Definition Player.h:499
@ PLAYER_FLAGS_UNK30
Definition Player.h:510
@ PLAYER_FLAGS_PLAYED_TOO_LONG
Definition Player.h:493
CurrencyItems
Definition Player.h:966
ActionButtonUpdateState
Definition Player.h:221
std::map< uint32, SpellCooldown > SpellCooldowns
Definition Player.h:209
std::list< uint32 > PlayerCreateInfoSpells
Definition Player.h:318
InstantFlightGossipAction
Definition Player.h:1024
std::unordered_map< uint32, time_t > InstanceTimeMap
Definition Player.h:210
std::map< uint32, bool > QuestStatusSaveMap
Definition Player.h:625
std::unordered_set< uint32 > RewardedQuestSet
Definition Player.h:622
RuneCooldowns
Definition Player.h:407
@ RUNE_MISS_COOLDOWN
Definition Player.h:410
std::list< PlayerCreateInfoItem > PlayerCreateInfoItems
Definition Player.h:292
PlayerFieldBytesOffsets
Definition Player.h:541
@ PLAYER_FIELD_BYTES_OFFSET_LIFETIME_MAX_PVP_RANK
Definition Player.h:545
@ PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES
Definition Player.h:544
@ PLAYER_FIELD_BYTES_OFFSET_RAF_GRANTABLE_LEVEL
Definition Player.h:543
@ PLAYER_FIELD_BYTES_OFFSET_FLAGS
Definition Player.h:542
PlayerCommandStates
Definition Player.h:1004
@ CHEAT_COOLDOWN
Definition Player.h:1008
@ CHEAT_WATERWALK
Definition Player.h:1010
@ CHEAT_CASTTIME
Definition Player.h:1007
PlayerDelayedOperations
Definition Player.h:909
RestFlag
Definition Player.h:820
@ ACTION_BUTTON_EQSET
Definition Player.h:232
@ ACTION_BUTTON_C
Definition Player.h:231
@ ACTION_BUTTON_MACRO
Definition Player.h:233
@ ACTION_BUTTON_CMACRO
Definition Player.h:234
BuyBackSlots
Definition Player.h:729
std::map< uint8, ActionButton > ActionButtonList
Definition Player.h:282
@ XPSOURCE_KILL
Definition Player.h:1016
InventorySlots
Definition Player.h:705
QuestSlotOffsets
Definition Player.h:628
std::unordered_map< uint32, SkillStatusData > SkillStatusMap
Definition Player.h:661
#define ACTION_BUTTON_TYPE(X)
Definition Player.h:255
PlayerMovementType
Definition Player.h:461
BankBagSlots
Definition Player.h:723
std::list< PlayerCreateInfoAction > PlayerCreateInfoActions
Definition Player.h:330
CurrencyTokenSlots
Definition Player.h:742
BuyBankSlotResult
Definition Player.h:110
@ ERR_BANKSLOT_NOTBANKER
Definition Player.h:113
@ ERR_BANKSLOT_FAILED_TOO_MANY
Definition Player.h:111
@ ERR_BANKSLOT_OK
Definition Player.h:114
@ ERR_BANKSLOT_INSUFFICIENT_FUNDS
Definition Player.h:112
BankItemSlots
Definition Player.h:717
PlayedTimeIndex
Definition Player.h:861
SpellModType
Definition Player.h:92
#define MAX_PLAYED_TIME_INDEX
Definition Player.h:866
PlayerUnderwaterState
Definition Player.h:99
InstanceResetWarningType
Definition Player.h:809
@ RAID_INSTANCE_EXPIRED
Definition Player.h:814
std::map< uint32, EquipmentSet > EquipmentSets
Definition Player.h:769
AtLoginFlags
Definition Player.h:605
@ AT_LOGIN_RESET_PET_TALENTS
Definition Player.h:611
@ AT_LOGIN_RESET_AP
Definition Player.h:615
@ AT_LOGIN_RESET_ARENA
Definition Player.h:616
@ AT_LOGIN_CHECK_ACHIEVS
Definition Player.h:617
PlayerBytes3Offsets
Definition Player.h:533
@ PLAYER_BYTES_3_OFFSET_PVP_TITLE
Definition Player.h:536
@ PLAYER_BYTES_3_OFFSET_GENDER
Definition Player.h:534
@ PLAYER_BYTES_3_OFFSET_ARENA_FACTION
Definition Player.h:537
std::ostringstream & operator<<(std::ostringstream &ss, PlayerTaxi const &taxi)
Definition PlayerTaxi.cpp:228
CharDeleteMethod
Definition Player.h:959
TalentTree
Definition Player.h:144
PlayerRestState
Definition Player.h:990
#define ACTION_BUTTON_ACTION(X)
Definition Player.h:254
std::list< EnchantDuration > EnchantDurationList
Definition Player.h:457
AdditionalSaving
Definition Player.h:997
@ ADDITIONAL_SAVING_NONE
Definition Player.h:998
PlayerBytesOffsets
Definition Player.h:517
@ PLAYER_BYTES_OFFSET_HAIR_COLOR_ID
Definition Player.h:521
@ PLAYER_BYTES_OFFSET_HAIR_STYLE_ID
Definition Player.h:520
@ PLAYER_BYTES_OFFSET_SKIN_ID
Definition Player.h:518
@ PLAYER_BYTES_OFFSET_FACE_ID
Definition Player.h:519
MirrorTimerType
Definition Player.h:579
SkillUpdateState
Definition Player.h:645
DrunkenState
Definition Player.h:469
ReputationSource
Definition Player.h:239
PlayerFieldBytes2Offsets
Definition Player.h:549
@ PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID
Definition Player.h:550
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:552
@ PLAYER_FIELD_BYTES_2_OFFSET_IGNORE_POWER_REGEN_PREDICTION_MASK
Definition Player.h:551
PlayerChatTag
Definition Player.h:851
std::map< uint32, QuestStatusData > QuestStatusMap
Definition Player.h:621
PlayerBytes2Offsets
Definition Player.h:525
@ PLAYER_BYTES_2_OFFSET_PARTY_TYPE
Definition Player.h:527
@ PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS
Definition Player.h:528
@ PLAYER_BYTES_2_OFFSET_REST_STATE
Definition Player.h:529
@ PLAYER_BYTES_2_OFFSET_FACIAL_STYLE
Definition Player.h:526
EmoteBroadcastTextID
Definition Player.h:1029
@ EMOTE_BROADCAST_TEXT_ID_STRANGE_GESTURES
Definition Player.h:1030
PlayerSlots
Definition Player.h:669
PlayerLoginQueryIndex
Definition Player.h:870
@ MAX_PLAYER_LOGIN_QUERY
Definition Player.h:905
@ PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA
Definition Player.h:891
@ PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION
Definition Player.h:901
GuidList WhisperListContainer
Definition Player.h:197
std::list< Item * > ItemDurationList
Definition Player.h:458
ServerSideVisibilityType
Definition SharedDefines.h:1272
GameobjectTypes
Definition SharedDefines.h:1559
MailResponseType
Definition SharedDefines.h:3754
TradeStatus
Definition SharedDefines.h:3804
DuelCompleteType
Definition SharedDefines.h:3866
MailResponseResult
Definition SharedDefines.h:3764
BattlegroundQueueTypeId
Definition SharedDefines.h:3874
RemoveMethod
Definition SharedDefines.h:3841
@ GROUP_REMOVEMETHOD_DEFAULT
Definition SharedDefines.h:3842
PartyResult
Definition SharedDefines.h:3959
SpellModOp
Definition SpellDefines.h:75
ClassContext
Definition UnitDefines.h:225
@ CLASS_CONTEXT_NONE
Definition UnitDefines.h:226
SheathState
Definition UnitDefines.h:125
BaseModType
Definition Unit.h:189
#define MOD_END
Definition Unit.h:194
DeathState
Definition Unit.h:197
Say
Definition boss_broodlord_lashlayer.cpp:29
Definition WorldSession.h:268
Definition CinematicMgr.h:33
Definition CharmInfo.h:80
Definition Object.h:359
void AddToUpdateQueueOf(Player *player)
Definition Item.cpp:744
void RemoveFromUpdateQueueOf(Player *player)
Definition Item.cpp:764
Definition LootMgr.h:207
Definition MapReference.h:25
Definition SocialMgr.h:101
Definition PlayerTaxi.h:26
uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const *newSkin=nullptr)
Definition Player.cpp:13215
void AddNewMailDeliverTime(time_t deliver_time)
Definition Player.cpp:2897
void ReputationChanged(FactionEntry const *factionEntry)
Definition PlayerQuest.cpp:2208
bool CanSpeak() const
Definition PlayerMisc.cpp:69
std::string GetPlayerName()
Definition Player.cpp:16263
void CleanupChannels()
Definition Player.cpp:5035
void ProcessTerrainStatusUpdate() override
Definition PlayerUpdates.cpp:2253
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex) override
Definition StatSystem.cpp:544
void SendInitialPacketsAfterAddToMap()
Definition Player.cpp:11604
void ResetSeasonalQuestStatus(uint16 event_id)
Definition Player.cpp:12145
uint32 GetPendingBind() const
Definition Player.h:2457
uint32 GetArmorProficiency() const
Definition Player.h:1377
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition Player.cpp:10066
void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError=0, ObjectGuid::LowType item_guid=0, uint32 item_count=0)
Definition Player.cpp:2873
SpellModList const & GetSpellModList(uint32 type) const
Definition Player.h:2628
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const
Definition Player.cpp:13446
std::set< uint32 > SeasonalQuestSet
Definition Player.h:2711
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:13352
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
Definition Player.cpp:12208
void SendAttackSwingCancelAttack()
Definition PlayerMisc.cpp:140
void SaveHealthBeforeDuel()
Definition Player.h:2179
void SendSystemMessage(std::string_view msg, bool escapeCharacters=false)
Definition Player.cpp:16325
void UpdateRuneRegen(RuneType rune)
Definition StatSystem.cpp:987
void removeActionButton(uint8 button)
Definition Player.cpp:5670
void SetNeedZoneUpdate(bool needUpdate)
Definition Player.h:1873
static void OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans)
Definition Player.cpp:4616
void HandleFall(MovementInfo const &movementInfo)
Definition Player.cpp:13819
std::size_t GetRewardedQuestCount() const
Definition Player.h:1642
void SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay=0, bool asSpectator=false)
Definition Player.cpp:16285
uint8 GetChatTag() const
Definition Player.cpp:1318
bool isAllowedToLoot(Creature const *creature)
Definition PlayerStorage.cpp:5627
void setTeamId(TeamId teamid)
Definition Player.h:2128
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask)
Definition Player.cpp:10090
uint64 GetAuraUpdateMaskForRaid() const
Definition Player.h:2492
void AddBonusTalent(uint32 count)
Definition Player.h:1749
void RemoveSpellMods(Spell *spell)
Definition Player.cpp:9988
void ToggleMetaGemsActive(uint8 exceptslot, bool apply)
Definition Player.cpp:11229
uint32 GetSaveTimer() const
Definition Player.h:2373
void RewardExtraBonusTalentPoints(uint32 bonusTalentPoints)
Definition Player.cpp:6086
uint8 GetRank() const
Definition Player.h:1912
bool HasQuestForGO(int32 GOId) const
Definition Player.cpp:12351
bool HasTankSpec()
Definition Player.cpp:16035
bool UpdateFishingSkill()
Definition PlayerUpdates.cpp:886
bool isGMVisible() const
Definition Player.h:1186
bool GetRandomWinner()
Definition Player.h:2309
void SetGuildIdInvited(uint32 GuildId)
Definition Player.h:1913
uint32 GetFreeInventorySpace() const
Definition PlayerStorage.cpp:466
void SetSummonAsSpectator(bool on)
Definition Player.h:1118
void SendRemoveControlBar()
Definition Player.cpp:9740
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap)
Definition Player.cpp:11705
static uint32 GetZoneIdFromDB(ObjectGuid guid)
Definition Player.cpp:6350
void SummonIfPossible(bool agree, ObjectGuid summoner_guid)
Definition Player.cpp:12387
void SetFarSightDistance(float radius)
Definition Player.cpp:16237
void SetLastUsedRune(RuneType type)
Definition Player.h:2530
float GetMissPercentageFromDefence() const
Definition StatSystem.cpp:725
bool IsInWhisperWhiteList(ObjectGuid guid)
Definition Player.cpp:15857
bool isResurrectRequestedBy(ObjectGuid guid) const
Definition Player.h:1840
uint32 GetTemporaryUnsummonedPetNumber() const
Definition Player.h:2430
void SetServerSideVisibility(ServerSideVisibilityType type, AccountTypes sec)
Definition Player.cpp:16223
std::string autoReplyMsg
Definition Player.h:1156
uint32 GetCurrentBattlegroundQueueSlot() const
Definition Player.h:2274
RewardedQuestSet const & getRewardedQuests() const
Definition Player.h:1638
InventoryResult CanRollForItemInLFG(ItemTemplate const *item, WorldObject const *lootedObject) const
Definition PlayerStorage.cpp:2337
void SetInWater(bool apply)
Definition Player.cpp:2176
bool HasWeapon(WeaponAttackType type) const override
Definition Player.h:1273
void ClearAfkReports()
Definition Player.h:2302
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:152
void DestroyForPlayer(Player *target, bool onDeath=false) const override
Definition Player.cpp:3873
void SplitItem(uint16 src, uint16 dst, uint32 count)
Definition PlayerStorage.cpp:3421
void _LoadFriendList(PreparedQueryResult result)
bool IsInvitedForBattlegroundInstance() const
Definition Player.h:2275
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
Definition Player.cpp:10517
void SetGrantableLevels(uint8 val)
Definition Player.h:2141
uint32 DoRandomRoll(uint32 minimum, uint32 maximum)
Definition Player.cpp:16144
bool HasMeleeSpec()
Definition Player.cpp:16053
void SendAttackSwingDeadTarget()
Definition PlayerMisc.cpp:128
Item * GetItemByEntry(uint32 entry) const
Definition PlayerStorage.cpp:3369
std::unordered_map< ObjectGuid::LowType, Item * > ItemMap
Definition Player.h:1676
void BuildEnchantmentsInfoData(WorldPacket *data)
Definition Player.cpp:14401
void SetCanParry(bool value)
Definition Player.cpp:13091
GroupReference & GetGroupRef()
Definition Player.h:2487
uint32 GetInGameTime()
Definition Player.h:1566
GroupReference & GetOriginalGroupRef()
Definition Player.h:2501
void UpdatePotionCooldown(Spell *spell=nullptr)
Definition PlayerUpdates.cpp:1547
bool CanTameExoticPets() const
Definition Player.h:2207
bool CanFly() const override
Definition Player.h:2586
void CharmSpellInitialize()
Definition Player.cpp:9686
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition PlayerUpdates.cpp:1025
void SetTemporaryUnsummonedPetNumber(uint32 petnumber)
Definition Player.h:2431
DeclinedName const * GetDeclinedNames() const
Definition Player.h:2521
void ReputationChanged2(FactionEntry const *factionEntry)
Definition PlayerQuest.cpp:2236
static void Customize(CharacterCustomizeInfo const *customizeInfo, CharacterDatabaseTransaction trans)
Definition PlayerMisc.cpp:114
BGData & GetBGData()
Definition Player.h:2277
void Update(uint32 time) override
Definition PlayerUpdates.cpp:53
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition Player.h:2493
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition Player.cpp:470
void UpdateEnchantmentDurations()
Definition PlayerStorage.cpp:4741
float GetTotalBaseModValue(BaseModGroup modGroup) const
Definition Player.cpp:5105
bool CanUseBattlegroundObject(GameObject *gameobject) const
Definition Player.cpp:13185
void GetTalentTreePoints(uint8(&specPoints)[3]) const
Definition Player.cpp:15249
bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
Definition Player.cpp:12199
uint32 GetDeathTimer() const
Definition Player.h:2194
bool UpdateCraftSkill(uint32 spellid)
Definition PlayerUpdates.cpp:824
void SendQuestConfirmAccept(Quest const *quest, Player *pReceiver)
Definition PlayerQuest.cpp:2413
void SetEntryPoint()
Definition Player.cpp:11262
bool IsMirrorTimerActive(MirrorTimerType type)
Definition Player.h:2078
bool CanKnockback()
Definition Player.h:2516
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition Player.cpp:4850
void SetDeveloper(bool on)
Definition Player.h:1174
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
Definition Player.h:1920
void CompletedAchievement(AchievementEntry const *entry)
Definition Player.cpp:13907
std::set< uint32 > DFQuestsDoneList
Definition Player.h:2426
bool inRandomLfgDungeon()
Definition Player.cpp:13039
void SetCanKnockback(bool value)
Definition Player.h:2517
bool IsInWater() const override
Definition Player.h:1138
void TalkedToCreature(uint32 entry, ObjectGuid guid)
Definition PlayerQuest.cpp:2112
bool canFlyInZone(uint32 mapid, uint32 zone, SpellInfo const *bySpell)
Definition Player.cpp:13610
void RemoveMail(uint32 id)
Definition Player.cpp:2860
void setWeaponChangeTimer(uint32 time)
Definition Player.h:1619
bool SetCanFly(bool apply, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Player.cpp:15887
void RemoveFromBattlegroundOrBattlefieldRaid()
Definition Player.cpp:13066
void LoadActions(PreparedQueryResult result)
Definition Player.cpp:15241
QuestGiverStatus GetQuestDialogStatus(Object *questGiver)
Definition PlayerQuest.cpp:1595
void AddInstanceEnterTime(uint32 instanceId, time_t enterTime)
Definition Player.h:2467
uint32 GetGuildIdInvited()
Definition Player.h:1916
bool HasCorpse() const
Definition Player.h:2055
void SendInitialPacketsBeforeAddToMap()
Definition Player.cpp:11547
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
Definition PlayerQuest.cpp:1818
void setRegenTimerCount(uint32 time)
Definition Player.h:1618
bool HasReceivedSpectatorResetFor(ObjectGuid guid)
Definition Player.h:2599
void ResetMap() override
Definition Player.cpp:14631
void ResurectUsingRequestData()
Definition Player.cpp:12791
void RemoveRestState()
Definition Player.cpp:1092
void SendDungeonDifficulty(bool IsInGroup)
Definition PlayerMisc.cpp:167
void AddItemToBuyBackSlot(Item *pItem, uint32 money)
Definition PlayerStorage.cpp:3936
void ResetMonthlyQuestStatus()
Definition Player.cpp:12155
void ResetDailyQuestStatus()
Definition Player.cpp:12123
void Initialize(ObjectGuid::LowType guid)
Definition PlayerStorage.cpp:4787
bool CheckInstanceCount(uint32 instanceId) const
Definition PlayerStorage.cpp:6995
void UpdateTriggerVisibility()
Definition PlayerUpdates.cpp:1748
void SetGMSpectator(bool on)
Definition Player.h:1182
std::vector< Unit * > m_newVisible
Definition Player.h:2399
void SetReputation(uint32 factionentry, float value)
Definition Player.cpp:15301
void ResyncRunes(uint8 count)
Definition Player.cpp:13393
bool UpdateStats(Stats stat) override
Definition StatSystem.cpp:97
void KilledMonster(CreatureTemplate const *cInfo, ObjectGuid guid)
Definition PlayerQuest.cpp:1915
void SwapItem(uint16 src, uint16 dst)
Definition PlayerStorage.cpp:3536
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
Definition Player.cpp:10689
void SetRestState(uint32 triggerId)
Definition Player.cpp:1085
bool HasItemTotemCategory(uint32 TotemCategory) const
Definition PlayerStorage.cpp:851
void AddReceivedSpectatorResetFor(ObjectGuid guid)
Definition Player.h:2601
uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry)
Definition PlayerQuest.cpp:1751
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition Player.cpp:15870
void RemoveAmmo()
Definition PlayerStorage.cpp:2514
bool Create(ObjectGuid::LowType guidlow, CharacterCreateInfo *createInfo)
Definition Player.cpp:478
uint8 GetRunesState() const
Definition Player.h:2522
void SendDuelCountdown(uint32 counter)
Definition Player.cpp:15316
void SetAtLoginFlag(AtLoginFlags f)
Definition Player.h:2420
void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) override
Definition Player.cpp:3842
void SetCanBlock(bool value)
Definition Player.cpp:13100
bool IsDeserter() const
Definition Player.h:2282
bool InBattlegroundQueue(bool ignoreArena=false) const
Definition Player.cpp:12174
int16 GetSkillTempBonusValue(uint32 skill) const
Definition Player.cpp:5572
void RestoreBaseRune(uint8 index)
Definition Player.cpp:13364
int16 GetSkillPermBonusValue(uint32 skill) const
Definition Player.cpp:5560
void SendRaidInfo()
Definition PlayerStorage.cpp:6534
void DeleteEquipmentSet(uint64 setGuid)
Definition Player.cpp:14590
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:12482
bool CanTeleport()
Definition Player.h:2514
void SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
Definition Player.cpp:12275
void SetServerSideVisibilityDetect(ServerSideVisibilityType type, AccountTypes sec)
Definition Player.cpp:16230
void DestroyConjuredItems(bool update)
Definition PlayerStorage.cpp:3342
bool CanPetResurrect()
Definition Player.cpp:9191
void SetCommandStatusOn(uint32 command)
Definition Player.h:1201
void LearnTalent(uint32 talentId, uint32 talentRank, bool command=false)
Definition Player.cpp:13912
int32 GetSpellPenetrationItemMod() const
Definition Player.h:1989
bool IsNeverVisible() const override
Definition Player.cpp:11410
void AddMail(Mail *mail)
Definition Player.h:1661
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
Definition Player.cpp:12237
void SetTarget(ObjectGuid=ObjectGuid::Empty) override
Definition Player.h:1651
void ResetFarSightDistance()
Definition Player.cpp:16242
bool RemoveMItem(ObjectGuid::LowType itemLowGuid)
Definition Player.h:1693
float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
Definition Player.cpp:5091
void SetPassOnGroupLoot(bool bPassOnGroupLoot)
Definition Player.h:2505
void SendSellError(SellResult msg, Creature *creature, ObjectGuid guid, uint32 param)
Definition PlayerStorage.cpp:4076
static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot)
Definition Player.cpp:6336
PlayerSetting GetPlayerSetting(std::string const &source, uint8 index)
Definition PlayerSettings.cpp:62
void ClearWhisperWhiteList()
Definition Player.h:2575
void RemoveCorpse()
Definition Player.cpp:4706
bool CanAlwaysSee(WorldObject const *obj) const override
Definition Player.cpp:11421
void SwapQuestSlot(uint16 slot1, uint16 slot2)
Definition Player.h:1521
ObjectGuid GetDivider()
Definition Player.h:1563
uint16 GetSkillStep(uint16 skill) const
Definition Player.cpp:5471
std::string const & GetGuildName()
Definition Player.cpp:15311
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition Player.cpp:12695
void UpdateSpecCount(uint8 count)
Definition PlayerUpdates.cpp:2196
CinematicMgr * GetCinematicMgr() const
Definition Player.h:1395
void UpdateFallInformationIfNeed(MovementInfo const &minfo, uint16 opcode)
Definition PlayerUpdates.cpp:2188
void SendRespondInspectAchievements(Player *player) const
Definition Player.cpp:13882
bool HasHealSpec()
Definition Player.cpp:16099
std::unordered_map< uint32, SeasonalQuestSet > SeasonalEventQuestMap
Definition Player.h:2712
bool CanNoReagentCast(SpellInfo const *spellInfo) const
Definition Player.cpp:12532
void LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
Definition Player.cpp:14045
uint32 m_AreaID
Definition Player.h:2679
uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank)
Definition Player.cpp:4856
std::set< uint32 > QuestSet
Definition Player.h:2710
void SetBGData(BGData &bgdata)
Definition Player.h:2278
bool HasWeaponForAttack(WeaponAttackType type) const override
Definition Player.h:1274
bool HasQuest(uint32 questId) const
Definition PlayerQuest.cpp:101
void SendResetFailedNotify(uint32 mapid)
Definition PlayerMisc.cpp:187
uint32 GetSpellByProto(ItemTemplate *proto)
void SendAttackSwingCantAttack()
Definition PlayerMisc.cpp:134
void RestoreManaAfterDuel()
Definition Player.h:2182
void RemoveFromWhisperWhiteList(ObjectGuid guid)
Definition Player.h:2578
void RemoveCategoryCooldown(uint32 cat)
Definition Player.cpp:3556
PartyResult CanUninviteFromGroup(ObjectGuid targetPlayerGUID=ObjectGuid::Empty) const
Definition Player.cpp:12976
void MoveItemToInventory(ItemPosCountVec const &dest, Item *pItem, bool update, bool in_characterInventoryDB=false)
Definition PlayerStorage.cpp:2998
uint32 GetBaseSpellHealingBonus()
Definition Player.h:1988
ActionButton const * GetActionButton(uint8 button)
Definition Player.cpp:5684
bool CanJoinToBattleground() const
Definition Player.cpp:11337
void RestoreHealthAfterDuel()
Definition Player.h:2181
bool IsAtLootRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:12749
void RestoreAllSpellMods(uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition Player.cpp:9981
void SendQuestUpdateAddItem(Quest const *quest, uint32 item_idx, uint16 count)
Definition PlayerQuest.cpp:2447
uint32 GetWeaponProficiency() const
Definition Player.h:1376
void RemoveReceivedSpectatorResetFor(ObjectGuid guid)
Definition Player.h:2602
void SetBonusTalentCount(uint32 count)
Definition Player.h:1747
Item * GetShield(bool useable=false) const
Definition PlayerStorage.cpp:523
~Player() override
Definition Player.cpp:421
SpellCooldowns const & GetSpellCooldownMap() const
Definition Player.h:1789
bool HasFreeBattlegroundQueueId() const
Definition Player.cpp:12228
bool CanSeeVendor(Creature const *creature) const
Definition Player.cpp:14270
uint32 GetBaseSpellDamageBonus()
Definition Player.h:1987
void SetInGuild(uint32 GuildId)
Definition Player.h:1905
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.h:2536
void SetCommentator(bool on)
Definition Player.h:1172
void ClearChannelWatch()
Definition Player.cpp:5045
void ProcessDelayedOperations()
Definition Player.cpp:1629
float GetAverageItemLevel()
Definition Player.cpp:15690
bool HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const override
Definition Player.cpp:16306
ObjectGuid getRuneWeaponGUID()
Definition Player.h:2609
float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
Definition Player.cpp:5236
void UpdateResistances(uint32 school) override
Definition StatSystem.cpp:242
void SetCommandStatusOff(uint32 command)
Definition Player.h:1202
void setRuneWeaponGUID(ObjectGuid guid)
Definition Player.h:2608
bool IsActiveQuest(uint32 quest_id) const
Definition PlayerQuest.cpp:202
void ClearReceivedSpectatorResetFor()
Definition Player.h:2600
void ResetWeeklyQuestStatus()
Definition Player.cpp:12135
float GetRealParry() const
Definition Player.h:2623
uint32 GetNextSave() const
Definition Player.h:2627
void SetChampioningFaction(uint32 faction)
Definition Player.h:2568
bool hasSpanishClient()
Definition Player.h:1104
void SendMovieStart(uint32 MovieId)
Definition Player.cpp:5741
LootItem * StoreLootItem(uint8 lootSlot, Loot *loot, InventoryResult &msg)
Definition Player.cpp:13482
void LoadCorpse(PreparedQueryResult result)
Definition PlayerStorage.cpp:5822
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val)
Definition Player.cpp:12213
void SendCinematicStart(uint32 CinematicSequenceId) const
Definition Player.cpp:5730
void LoadPet()
Definition PlayerStorage.cpp:6223
bool isResurrectRequested() const
Definition Player.h:1841
bool IsGMSpectator() const
Definition Player.h:1181
Optional< float > GetFarSightDistance() const
Definition Player.cpp:16247
void SetEquipmentSet(uint32 index, EquipmentSet eqset)
Definition Player.cpp:14474
void UpdateMirrorTimers()
Definition PlayerUpdates.cpp:429
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition Player.cpp:5342
SpellCooldowns GetSpellCooldowns() const
Definition Player.h:2186
TrainerSpellState GetTrainerSpellState(TrainerSpell const *trainer_spell) const
Definition Player.cpp:3922
uint32 GetLastPetNumber() const
Definition Player.h:2474
uint8 getCinematic() const
Definition Player.h:1844
uint32 GetBonusTalentCount()
Definition Player.h:1748
void DurabilityPointsLossAll(int32 points, bool inventory)
Definition Player.cpp:4794
bool IsVisibleGloballyFor(Player const *player) const
Definition Player.cpp:11455
uint32 GetLevelPlayedTime()
Definition Player.h:1209
void SetPendingSpectatorInviteInstanceId(uint32 bgInstanceId)
Definition Player.h:2597
bool IsBeingTeleportedNear() const
Definition Player.h:2109
Seconds GetCreationTime() const
Definition Player.h:2556
void SaveManaBeforeDuel()
Definition Player.h:2180
time_t GetSummonExpireTimer() const
Definition Player.h:1120
void SetRank(uint8 rankId)
Definition Player.h:1911
Pet * CreatePet(Creature *creatureTarget, uint32 spellID=0)
Definition Player.cpp:9230
void ToggleAFK()
Definition Player.cpp:1304
Pet * SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration=0s, uint32 healthPct=0)
Definition Player.cpp:8959
void OnGossipSelect(WorldObject *source, uint32 gossipListId, uint32 menuId)
Definition PlayerGossip.cpp:244
void PossessSpellInitialize()
Definition Player.cpp:9583
bool LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const &holder)
Definition PlayerStorage.cpp:4925
AchievementMgr * GetAchievementMgr() const
Definition Player.h:2553
std::vector< Item * > & GetItemUpdateQueue()
Definition Player.h:1277
SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const override
Definition Player.cpp:7020
bool TakeQuestSourceItem(uint32 questId, bool msg)
Definition PlayerQuest.cpp:1363
Item * GetMItem(ObjectGuid::LowType itemLowGuid)
Definition Player.h:1680
void SetSheath(SheathState sheathed) override
Definition PlayerStorage.cpp:97
Item * GetItemFromBuyBackSlot(uint32 slot)
Definition PlayerStorage.cpp:3987
void CalcRage(uint32 damage, bool attacker)
bool HasCasterSpec()
Definition Player.cpp:16076
void UpdateLFGChannel()
Definition PlayerUpdates.cpp:464
static bool LoadPositionFromDB(uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, ObjectGuid::LowType guid)
Definition PlayerStorage.cpp:4882
static bool BuildEnumData(PreparedQueryResult result, WorldPacket *data)
Definition Player.cpp:1099
SkillStatusMap const & GetSkillStatusMap() const
Definition Player.h:1792
bool IsDailyQuestDone(uint32 quest_id)
Definition Player.cpp:12085
void UpdateSpeakTime(ChatFloodThrottle::Index index)
Definition PlayerMisc.cpp:29
bool Satisfy(DungeonProgressionRequirements const *ar, uint32 target_map, bool report=false)
Definition PlayerStorage.cpp:6720
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition Player.cpp:11434
void AddArmorProficiency(uint32 newflag)
Definition Player.h:1375
void KillCreditGO(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:2056
bool IsFalling() const
Definition Player.cpp:2170
std::list< Channel * > JoinedChannelsList
Definition Player.h:2866
void ResetAllPowers()
Definition Player.cpp:2050
Quest const * GetNextQuest(ObjectGuid guid, Quest const *quest)
Definition PlayerQuest.cpp:207
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition Player.cpp:12821
uint32 GetGroupUpdateFlag() const
Definition Player.h:2490
void SetHomebind(WorldLocation const &loc, uint32 areaId)
Definition PlayerStorage.cpp:4903
uint32 GetArenaTeamIdInvited()
Definition Player.h:1931
void SetSaveTimer(uint32 timer)
Definition Player.h:2374
bool CanShareQuest(uint32 quest_id) const
Definition PlayerQuest.cpp:1458
Player * GetSelectedPlayer() const
Definition Player.cpp:11516
void ModifySpellCooldown(uint32 spellId, int32 cooldown)
Definition Player.cpp:11071
void AddWhisperWhiteList(ObjectGuid guid)
Definition Player.h:2576
bool GetPassOnGroupLoot() const
Definition Player.h:2506
Unit * GetSelectedUnit() const
Definition Player.cpp:11508
Player * GetNextRandomRaidMember(float radius)
Definition Player.cpp:12950
void AddToWorld() override
Definition Player.cpp:1713
void RemoveAllSpellCooldown()
Definition Player.cpp:3599
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition Player.cpp:13897
void SetIsSpectator(bool on)
Definition Player.cpp:15323
bool isHonorOrXPTarget(Unit *victim) const
Definition Player.cpp:12638
uint32 GetPhaseMaskForSpawn() const
Definition Player.cpp:13741
bool CanRequestSpellCast(SpellInfo const *spellInfo)
Definition PlayerUpdates.cpp:2339
float GetRealDodge() const
Definition Player.h:2624
void SetShowDKPet(bool on)
Definition Player.h:2613
void SetDivider(ObjectGuid guid=ObjectGuid::Empty)
Definition Player.h:1564
bool IsCurrentBattlegroundRandom() const
Definition Player.h:2276
uint8 GetMostPointsTalentTree() const
Definition Player.cpp:15270
static void ResetInstances(ObjectGuid guid, uint8 method, bool isRaid)
Reset all solo instances and optionally send a message on success for each.
Definition PlayerMisc.cpp:195
void UninviteFromGroup()
Definition Player.cpp:2330
void KilledPlayerCredit(uint16 count=1)
Definition PlayerQuest.cpp:1995
void VehicleSpellInitialize()
Definition Player.cpp:9611
bool SetFeatherFall(bool apply, bool packetOnly=false) override
Definition Player.cpp:15951
void AbandonQuest(uint32 quest_id)
Definition PlayerQuest.cpp:930
void RemoveRewardedQuest(uint32 questId, bool update=true)
Definition PlayerQuest.cpp:1513
void Yell(std::string_view text, Language language, WorldObject const *=nullptr) override
Handles yelled message in regular chat based on declared language and in config pre-defined Range.
Definition Player.cpp:9392
void CastItemUseSpell(Item *item, SpellCastTargets const &targets, uint8 cast_count, uint32 glyphIndex)
Definition Player.cpp:7391
std::string GetDebugInfo() const override
Definition Player.cpp:16318
void SetTaxiCheater(bool on)
Definition Player.h:1185
void TextEmote(std::string_view text, WorldObject const *=nullptr, bool=false) override
Outputs an universal text which is supposed to be an action.
Definition Player.cpp:9418
void ReportedAfkBy(Player *reporter)
This player has been blamed to be inactive in a battleground.
Definition Player.cpp:11356
time_t GetSemaphoreTeleportNear() const
Definition Player.h:2113
void RefundItem(Item *item)
Definition Player.cpp:15558
void SetArenaTeamIdInvited(uint32 ArenaTeamId)
Definition Player.h:1930
void Whisper(std::string_view text, Language language, Player *receiver, bool=false) override
Handles whispers from Addons and players based on sender, receiver's guid and language.
Definition Player.cpp:9444
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:9869
void ToggleDND()
Definition Player.cpp:1313
void ResummonPetTemporaryUnSummonedIfAny()
Definition Player.cpp:14201
void AddRunePower(uint8 index)
Definition Player.cpp:13405
RuneType GetLastUsedRune()
Definition Player.h:2529
void RemovedInsignia(Player *looterPlr)
Definition Player.cpp:7751
void RemoveFromWorld() override
Definition Player.cpp:1725
void UpdateEnergyRegen()
Definition StatSystem.cpp:977
void JoinedChannel(Channel *c)
Definition Player.cpp:5025
bool CanSeeSpellClickOn(Creature const *creature) const
Definition Player.cpp:14247
bool CanEnterWater() const override
Definition Player.h:2587
WorldLocation GetStartPosition() const
Definition Player.cpp:11381
void AddWeaponProficiency(uint32 newflag)
Definition Player.h:1374
void RemoveBonusTalent(uint32 count)
Definition Player.h:1750
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
Definition PlayerMisc.cpp:84
bool IsSummonAsSpectator() const
Definition Player.cpp:16295
void SetPendingSpectatorForBG(uint32 bgInstanceId)
Definition Player.h:2595
void SetContestedPvPTimer(uint32 newTime)
Definition Player.h:1882
bool IsOutdoorPvPActive()
Definition Player.cpp:6438
void SetInGameTime(uint32 time)
Definition Player.h:1568
bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition Player.cpp:15909
uint32 GetPendingSpectatorInviteInstanceId() const
Definition Player.h:2598
bool CanInteractWithQuestGiver(Object *questGiver)
Definition Player.cpp:2071
uint32 GetQuestSlotTime(uint16 slot) const
Definition Player.h:1502
Mail * GetMail(uint32 id)
Definition Player.cpp:3830
BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const
Definition Player.cpp:12185
void SetBankBagSlotCount(uint8 count)
Definition Player.h:1288
uint8 GetGrantableLevels()
Definition Player.h:2140
uint32 GetDelayedOperations() const
Definition Player.h:2116
void setCinematic(uint8 cine)
Definition Player.h:1848
bool CheckInstanceLoginValid()
Definition PlayerStorage.cpp:6966
void SetLastPetNumber(uint32 petnumber)
Definition Player.h:2475
bool isTaxiCheater() const
Definition Player.h:1184
uint32 GetQuestSlotState(uint16 slot) const
Definition Player.h:1500
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
Definition Player.cpp:13050
InventoryResult CanStoreItems(Item **pItem, int32 count) const
Definition PlayerStorage.cpp:1539
void SetSession(WorldSession *sess)
Definition Player.h:2017
void RemoveArenaEnchantments(EnchantmentSlot slot)
Definition PlayerStorage.cpp:4225
void resetSpells()
Definition Player.cpp:11788
bool CanCaptureTowerPoint() const
Definition Player.cpp:13207
void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId)
Definition Player.cpp:12250
GuidSet RefundableItemsSet
Definition Player.h:2956
void SendNotifyLootMoneyRemoved()
Definition Player.cpp:8190
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition Player.cpp:12287
void SetRandomWinner(bool isWinner)
Definition Player.cpp:15673
void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject *pRewardSource)
Definition Player.cpp:12700
QuestStatusSaveMap & GetQuestStatusSaveMap()
Definition Player.h:1640
void ResetAchievements()
Definition Player.cpp:13877
bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator=1)
Definition PlayerUpdates.cpp:762
time_t GetSemaphoreTeleportFar() const
Definition Player.h:2114
Definition QueryHolder.h:44
Definition UnitUtils.h:47
Definition Spell.h:111
Seconds const StartTime
Definition GameTime.cpp:25
Items
Definition oculus.h:74
Definition Player.h:395
Definition Player.h:1039
Definition DBCStructure.h:590
uint32 bit_index
Definition DBCStructure.h:639
Definition WorldSession.h:299
Definition Player.h:383
Definition Player.h:949
Definition Player.h:1056
Definition Object.h:288
Definition Player.h:302
Definition Player.h:321
Definition Player.h:285
Definition Player.h:333
Definition PlayerSettings.h:39
BattlegroundQueueTypeId bgQueueTypeId
Definition Player.h:2691
uint32 invitedToInstance
Definition Player.h:2692
uint32 Count
Definition Player.h:2341
time_t Time
Definition Player.h:2340
Index
Definition Player.h:2334
@ MAX
Definition Player.h:2337
Definition Player.h:363
Definition Player.h:423
Definition Player.h:781
Definition CreatureData.h:507

Referenced by SendInitWorldStates().

◆ duel

◆ healthBeforeDuel

uint32 Player::healthBeforeDuel
private

◆ isDebugAreaTriggers

◆ ItemSetEff

std::vector<ItemSetEffect*> Player::ItemSetEff

◆ m_achievementMgr

◆ m_actionButtons

◆ m_activeSpec

◆ m_additionalSaveMask

uint8 Player::m_additionalSaveMask
protected

◆ m_additionalSaveTimer

uint16 Player::m_additionalSaveTimer
protected

◆ m_ammoDPS

float Player::m_ammoDPS
protected

◆ m_AreaID

uint32 Player::m_AreaID
protected

◆ m_areaUpdateId

uint32 Player::m_areaUpdateId
protected

◆ m_ArenaTeamIdInvited

uint32 Player::m_ArenaTeamIdInvited
protected

◆ m_ArmorProficiency

uint32 Player::m_ArmorProficiency
protected

◆ m_atLoginFlags

uint32 Player::m_atLoginFlags
protected

◆ m_auraBaseMod

◆ m_auraRaidUpdateMask

◆ m_baseFeralAP

uint32 Player::m_baseFeralAP
protected

◆ m_baseHealthRegen

uint32 Player::m_baseHealthRegen
protected

◆ m_baseManaRegen

uint32 Player::m_baseManaRegen
protected

◆ m_baseRatingValue

int32 Player::m_baseRatingValue[MAX_COMBAT_RATING]
protected

◆ m_baseSpellDamage

uint32 Player::m_baseSpellDamage
protected

◆ m_baseSpellHealing

uint32 Player::m_baseSpellHealing
protected

◆ m_baseSpellPower

uint32 Player::m_baseSpellPower
protected

◆ m_bgData

◆ m_bHasDelayedTeleport

bool Player::m_bHasDelayedTeleport
private

◆ m_bMustDelayTeleport

bool Player::m_bMustDelayTeleport
private

◆ m_bPassOnGroupLoot

bool Player::m_bPassOnGroupLoot
protected

◆ m_canBlock

bool Player::m_canBlock
protected

Referenced by CanBlock(), Player(), and SetCanBlock().

◆ m_canKnockback

bool Player::m_canKnockback
private

◆ m_canParry

bool Player::m_canParry
protected

Referenced by CanParry(), Player(), and SetCanParry().

◆ m_canTeleport

bool Player::m_canTeleport
private

Referenced by CanTeleport(), Player(), and SetCanTeleport().

◆ m_canTitanGrip

bool Player::m_canTitanGrip
protected

◆ m_ChampioningFaction

uint32 Player::m_ChampioningFaction
private

◆ m_channels

◆ m_charmAISpells

uint32 Player::m_charmAISpells[NUM_CAI_SPELLS]
protected

◆ m_charmUpdateTimer

uint32 Player::m_charmUpdateTimer

Referenced by Player(), and Update().

◆ m_charSettingsMap

◆ m_chatFloodData

std::array<ChatFloodThrottle, ChatFloodThrottle::MAX> Player::m_chatFloodData
protected

Referenced by UpdateSpeakTime().

◆ m_cinematic

uint8 Player::m_cinematic
protected

◆ m_contestedPvPTimer

uint32 Player::m_contestedPvPTimer
protected

◆ m_creationTime

Seconds Player::m_creationTime
private

◆ m_currentBuybackSlot

uint32 Player::m_currentBuybackSlot
protected

◆ m_DailyQuestChanged

bool Player::m_DailyQuestChanged
protected

◆ m_deathExpireTime

◆ m_deathTimer

◆ m_declinedname

DeclinedName* Player::m_declinedname
protected

◆ m_DelayedOperations

uint32 Player::m_DelayedOperations
private

◆ m_DFQuests

◆ m_divider

ObjectGuid Player::m_divider
protected

Referenced by GetDivider(), and SetDivider().

◆ m_drunkTimer

uint32 Player::m_drunkTimer
protected

◆ m_drwGUID

ObjectGuid Player::m_drwGUID

◆ m_dungeonDifficulty

Difficulty Player::m_dungeonDifficulty
protected

◆ m_enchantDuration

◆ m_entryPointData

◆ m_EquipmentSets

◆ m_Expertise

float Player::m_Expertise
protected

◆ m_extraBonusTalentCount

◆ m_ExtraFlags

◆ m_flightSpellActivated

uint32 Player::m_flightSpellActivated
private

◆ m_foodEmoteTimerCount

uint32 Player::m_foodEmoteTimerCount
protected

Referenced by Player(), and RegenerateAll().

◆ m_forced_speed_changes

uint8 Player::m_forced_speed_changes[MAX_MOVE_TYPE]

◆ m_GlobalCooldownMgr

GlobalCooldownMgr Player::m_GlobalCooldownMgr
protected

Referenced by GetGlobalCooldownMgr().

◆ m_Glyphs

◆ m_grantableLevels

uint8 Player::m_grantableLevels
protected

◆ m_group

◆ m_groupInvite

Group* Player::m_groupInvite
protected

Referenced by GetGroupInvite(), and SetGroupInvite().

◆ m_groupUpdateMask

uint32 Player::m_groupUpdateMask
protected

◆ m_GuildIdInvited

uint32 Player::m_GuildIdInvited
protected

◆ m_homebindAreaId

uint16 Player::m_homebindAreaId

◆ m_homebindMapId

◆ m_HomebindTimer

uint32 Player::m_HomebindTimer

Referenced by Player(), and UpdateHomebindTime().

◆ m_homebindX

◆ m_homebindY

◆ m_homebindZ

◆ m_hostileReferenceCheckTimer

uint16 Player::m_hostileReferenceCheckTimer
protected

Referenced by Player(), and Update().

◆ m_ingametime

uint32 Player::m_ingametime
protected

◆ m_InstanceValid

◆ m_IsBGRandomWinner

bool Player::m_IsBGRandomWinner
protected

◆ m_isInSharedVisionOf

std::set<Unit*> Player::m_isInSharedVisionOf

◆ m_isInstantFlightOn

bool Player::m_isInstantFlightOn
private

◆ m_isInWater

bool Player::m_isInWater
private

Referenced by IsInWater(), Player(), and SetInWater().

◆ m_itemDuration

◆ m_items

◆ m_itemSoulboundTradeable

ItemDurationList Player::m_itemSoulboundTradeable
protected

◆ m_itemUpdateQueue

std::vector<Item*> Player::m_itemUpdateQueue
protected

◆ m_itemUpdateQueueBlocked

bool Player::m_itemUpdateQueueBlocked
protected

◆ m_Last_tick

time_t Player::m_Last_tick

Referenced by Create(), Player(), and Update().

◆ m_lastDailyQuestTime

time_t Player::m_lastDailyQuestTime
protected

◆ m_lastFallTime

uint32 Player::m_lastFallTime
private

◆ m_lastFallZ

float Player::m_lastFallZ
private

◆ m_lastHonorUpdateTime

time_t Player::m_lastHonorUpdateTime
protected

◆ m_lastpetnumber

uint32 Player::m_lastpetnumber
protected

◆ m_lastPotionId

uint32 Player::m_lastPotionId
protected

◆ m_logintime

time_t Player::m_logintime

Referenced by AddItemToBuyBackSlot(), and Player().

◆ m_lootGuid

ObjectGuid Player::m_lootGuid
protected

Referenced by GetLootGUID(), and SetLootGUID().

◆ m_mail

◆ m_mailsUpdated

◆ m_mapRef

MapReference Player::m_mapRef
private

Referenced by GetMapRef(), and SetMap().

◆ m_MirrorTimer

int32 Player::m_MirrorTimer[MAX_TIMERS]
private

◆ m_MirrorTimerFlags

uint8 Player::m_MirrorTimerFlags
private

◆ m_MirrorTimerFlagsLast

uint8 Player::m_MirrorTimerFlagsLast
private

◆ m_MonthlyQuestChanged

bool Player::m_MonthlyQuestChanged
protected

◆ m_monthlyquests

◆ m_MountBlockId

uint32 Player::m_MountBlockId
protected

◆ m_mover

◆ m_NeedToSaveGlyphs

bool Player::m_NeedToSaveGlyphs
protected

◆ m_needZoneUpdate

bool Player::m_needZoneUpdate
protected

◆ m_newVisible

std::vector<Unit*> Player::m_newVisible

◆ m_nextMailDelivereTime

time_t Player::m_nextMailDelivereTime

◆ m_nextSave

uint32 Player::m_nextSave
protected

◆ m_OffhandExpertise

float Player::m_OffhandExpertise
protected

◆ m_oldpetspell

uint32 Player::m_oldpetspell
private

◆ m_originalGroup

GroupReference Player::m_originalGroup
protected

◆ m_pendingSpectatorForBG

uint32 Player::m_pendingSpectatorForBG

◆ m_pendingSpectatorInviteInstanceId

uint32 Player::m_pendingSpectatorInviteInstanceId

◆ m_petStable

std::unique_ptr<PetStable> Player::m_petStable
private

◆ m_Played_time

◆ m_powerFraction

float Player::m_powerFraction[MAX_POWERS]
protected

Referenced by Player(), and Regenerate().

◆ m_questRewardTalentCount

uint32 Player::m_questRewardTalentCount
protected

◆ m_QuestStatus

◆ m_QuestStatusSave

◆ m_raidDifficulty

Difficulty Player::m_raidDifficulty
protected

◆ m_raidMapDifficulty

Difficulty Player::m_raidMapDifficulty
protected

◆ m_realDodge

float Player::m_realDodge
protected

◆ m_realParry

float Player::m_realParry
protected

◆ m_recallMap

uint32 Player::m_recallMap

Referenced by Player(), and SaveRecallPosition().

◆ m_recallO

float Player::m_recallO

Referenced by Player(), and SaveRecallPosition().

◆ m_recallX

float Player::m_recallX

Referenced by Player(), and SaveRecallPosition().

◆ m_recallY

float Player::m_recallY

Referenced by Player(), and SaveRecallPosition().

◆ m_recallZ

float Player::m_recallZ

Referenced by Player(), and SaveRecallPosition().

◆ m_receivedSpectatorResetFor

◆ m_refundableItems

RefundableItemsSet Player::m_refundableItems
private

◆ m_regenTimerCount

uint32 Player::m_regenTimerCount
protected

◆ m_reputationMgr

◆ m_resetTalentsCost

uint32 Player::m_resetTalentsCost
protected

◆ m_resetTalentsTime

time_t Player::m_resetTalentsTime
protected

◆ m_resurrectGUID

ObjectGuid Player::m_resurrectGUID
protected

◆ m_resurrectHealth

uint32 Player::m_resurrectHealth
protected

◆ m_resurrectMana

uint32 Player::m_resurrectMana
protected

◆ m_resurrectMap

uint32 Player::m_resurrectMap
protected

◆ m_resurrectX

float Player::m_resurrectX
protected

◆ m_resurrectY

float Player::m_resurrectY
protected

◆ m_resurrectZ

float Player::m_resurrectZ
protected

◆ m_RewardedQuests

◆ m_RewardedQuestsSave

QuestStatusSaveMap Player::m_RewardedQuestsSave
protected

◆ m_runes

◆ m_SeasonalQuestChanged

bool Player::m_SeasonalQuestChanged
protected

◆ m_seasonalquests

◆ m_seer

◆ m_session

◆ m_social

PlayerSocial* Player::m_social
protected

Referenced by GetSocial(), LoadFromDB(), and Player().

◆ m_soulboundTradableLock

std::mutex Player::m_soulboundTradableLock
protected

◆ m_specsCount

◆ m_spellCooldowns

◆ m_spellMods

◆ m_spellModTakingSpell

◆ m_spellPenetrationItemMod

int32 Player::m_spellPenetrationItemMod
protected

◆ m_spells

◆ m_summon_asSpectator

bool Player::m_summon_asSpectator
protected

◆ m_summon_expire

time_t Player::m_summon_expire
protected

◆ m_summon_mapid

uint32 Player::m_summon_mapid
protected

◆ m_summon_x

float Player::m_summon_x
protected

◆ m_summon_y

float Player::m_summon_y
protected

◆ m_summon_z

float Player::m_summon_z
protected

◆ m_swingErrorMsg

uint8 Player::m_swingErrorMsg
protected

Referenced by Player(), and Update().

◆ m_talents

◆ m_taxi

◆ m_team

TeamId Player::m_team
protected

◆ m_temporaryUnsummonedPetNumber

◆ m_timedquests

QuestSet Player::m_timedquests
protected

◆ m_trade

◆ m_usedTalentCount

uint32 Player::m_usedTalentCount
protected

◆ m_weaponChangeTimer

uint32 Player::m_weaponChangeTimer
protected

◆ m_WeaponProficiency

uint32 Player::m_WeaponProficiency
protected

◆ m_WeeklyQuestChanged

bool Player::m_WeeklyQuestChanged
protected

◆ m_weeklyquests

◆ m_zoneUpdateId

uint32 Player::m_zoneUpdateId
protected

◆ m_zoneUpdateTimer

uint32 Player::m_zoneUpdateTimer
protected

Referenced by Player(), Update(), and UpdateZone().

◆ manaBeforeDuel

uint32 Player::manaBeforeDuel
private

◆ mMitems

ItemMap Player::mMitems

◆ mSemaphoreTeleport_Far

time_t Player::mSemaphoreTeleport_Far
private

◆ mSemaphoreTeleport_Near

time_t Player::mSemaphoreTeleport_Near
private

◆ mSkillStatus

◆ PlayerTalkClass

PlayerMenu* Player::PlayerTalkClass

Referenced by AddGossipItemFor(), AddGossipItemFor(), AddGossipItemFor(), ClearGossipMenuFor(), CloseGossipMenuFor(), Spell::EffectQuestStart(), go_wind_stone::go_wind_stoneAI::GossipSelect(), OPvPCapturePointZM_Graveyard::HandleGossipOption(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandlePlayerLoginOpcode(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverCancel(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), WorldSession::HandleQuestgiverQueryQuestOpcode(), WorldSession::HandleQuestgiverRequestRewardOpcode(), WorldSession::HandleQuestgiverStatusQueryOpcode(), WorldSession::HandleQuestQueryOpcode(), npc_wg_quest_giver::OnGossipHello(), npc_elder_clearwater::OnGossipHello(), npc_experience::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), npc_cos_chromie_middle::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_icc_buff_switcher::OnGossipSelect(), OnGossipSelect(), Player(), PrepareGossipMenu(), PrepareQuestMenu(), WorldSession::SendBindPoint(), SendGossipMenuFor(), SendPreparedGossip(), SendPreparedQuest(), npc_costumed_orphan_matron::sGossipHello(), npc_pet_trainer::npc_pet_trainerAI::sGossipSelect(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_echo_of_medivh::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_sergeant_bly::npc_sergeant_blyAI::sGossipSelect(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), and ~Player().

◆ pvpInfo

◆ SpellQueue

◆ teleportStore_dest

WorldLocation Player::teleportStore_dest
private

Referenced by GetTeleportDest(), TeleportTo(), and Update().

◆ teleportStore_options

uint32 Player::teleportStore_options
private

Referenced by Player(), TeleportTo(), and Update().

◆ unReadMails

◆ WhisperList


The documentation for this class was generated from the following files: